In struts2 how can i get request parameter from android
In andr开发者_JAVA技巧oid i wrote a program that sends a string value to a servlet post method.
in the servlet, by using request.getParameter() i can receive the data.
Is the same applied to struts2? how to get the request parameter string in struts2 or anyother way to obtain the request parameter string.
You would create a variable in your action and then supply a public setter for it. If you need to expose the variable to a view (JSP page), then you will also want to provide a getter.
For example:
private String myValue;
public void setMyValue(final String myValue) {
this.myValue = myValue;
}
Then just pass the variable to the URL for the action. e.g., http://yoursite.com/youraction?myValue=easy
Struts will automatically invoke the setter and pass the value of the form parameter.
精彩评论