How To Call Method In Action Class In Javascript Using Struts2 Framework?
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
Solution 1:
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:formaction="myAction"name="myForm">
some data
</s:form>
on click you can do something like
functionredirect(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
Solution 2:
For similar implementations we used to use http://directwebremoting.org/dwr/index.html (DWR). You can try that.. if you have big implementation i would suggest you to integrate this framework
Post a Comment for "How To Call Method In Action Class In Javascript Using Struts2 Framework?"