I am trying to make an Ajax call to a Struts 2 action method and then displaying the value of a variable in the action class. Even though the method is getting called, I am unable to see the value of the variable. The getters and setters of the variable are in place in the action class.
My action method:
public String testMethod(){
//Set value of variable "myVariable"
}
The Ajax method:
$.ajax({
type: "POST",
url: "testmethod", //the declaration in struts.xml
success: function(){
//how to access value of myVariable here
}
});
in the success callback of the Ajax call in the JSP page, I am trying to access it via the <s:property>
but it does not seem to be working.