Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8467225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:34:52+00:00 2026-06-10T15:34:52+00:00

I am trying to call a method in action class in javascript function on

  • 0

I am trying to call a method in action class in javascript function on button click event which is in jsp.I am using struts 2.could you tell me how to do this?
There is a function in ListAlgorithmAction Class which I want to call when the user clicks submit button.

function alertselected (){
    var x = document.getElementById ( "select_name" ).selectedIndex;
    var y = document.getElementById ( "select_name" ).options;
    var id = y [x].index;
    redirect(id);
}

function redirect(x){
    document.getElementById ( "param_ID" ).value = x;
    document.forms ["./ListAlgorithmAction"].submit ();
}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T15:34:53+00:00Added an answer on June 10, 2026 at 3:34 pm

    I do not think this is something related to Struts2 ,since struts2 is independent of the way you call action class be it by java-script form submit,ajax or by simple form submit.

    i believe you have some form in your jsp like

    <s:form action="myAction" name="myForm">
      some data
    
    </s:form>
    

    on click you can do something like

    function redirect(x){
        document.getElementById("param_ID").value=x;
        document.myForm.action="ListAlgorithmAction";
         document.myForm.submit();
        }
    

    This is just solution based on your inputs and there can be many more if you able to define your problem more

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to call a method from another class with a simple button in
I am trying to call the browse() method of the FileReference class from JavaScript
I am trying to send email using the following method in my action class:
Possible Duplicate: javascript object, access variable property name? I'm trying to call a method
I'm trying to call a boolean method in another class and Eclipse is reporting
I am trying to raise a click event on a submit button in a
I am trying to call a jquery function on clicking a button in the
I am trying to call Action method passing a single parameter. The method (Accepts
I am trying to achieve a JQuery AJAX call to a controller action method
I'm trying to call method from .jar But when I want to declare array

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.