Let's get to know Actionform.
Actionform concept
The actionform is used to encapsulate the user's request parameters, and the request parameters are passed through the form field of the JSP page. Therefore, the Actionform parameter should be guaranteed to be the same as the name of the form field. Treatment of psoriasis www.0412l.com with Anshan
Edit this paragraph actionform configuration
All Actionform are configured in the Struts-config.xm L file, which includes a Form-beans element that defines all the actionform, each actionform corresponding to a form-bean element.
When the JSP page receives the Actionform property, if the input is Chinese, then the actionform will be garbled after receiving it.
The solution has 2:
In the action class, this I tried, not feasible.
In Actionform, this I tried, it worked, and it was convenient.
Add the following code to the Reset method in Actionform to output English or Chinese
View Sourceprint?
public void Reset (actionmapping mapping, HTTPS tutorial Ervletrequest request) {
try {
Request.setcharacterencoding ("GBK");
} catch (Exception e) {
Todo:handle exception
}
}
Then the action can output the properties of the Chinese. Anshan Treatment Psoriasis Hospital www.0412l.com
View Sourceprint?
Public Actionforward Execute (actionmapping mapping, Actionform form,
HttpServletRequest request, HttpServletResponse response) {
Personalform personalform = (personalform) form;//Todo auto-generated method stub
System.out.println (Personalform.getusername ());
System.out.println (Personalform.getpassword ());
Return Mapping.findforward ("Step2");
}
Solving method of Actionform Chinese garbled problem in JSP