I
1. Insert the following code in server. xml under Tomcat:
<Connector Port = "8080" protocol = "HTTP/1.1" uriencoding = "UTF-8" usebodyencodingforuri = "true"
Connectiontimeout = "20000"
Redirectport = "8443" type = "regxph" text = "yourobjectname"/>
2. Encrypt parameters to be passed in JSP page JS
Encodeuri (PARAM)
2. Write in action
Request. setcharacterencoding ("UTF-8 ");
New String (urldecoder. Decode (PARAM). getbytes ("iso-8859-1"), "UTF-8") (not required)
II
Copy http://blog.csdn.net/woshixuye/article/details/7547710 below
JSP
VaR num = $ ("# txtnum"). Val ();
VaR name = encodeuricomponent ($ ("# txtname"). Val ());
VaR classname = encodeuricomponent ($ ("# selectclasses option: Selected"). Text ());
In action
Stu. setnum (urldecoder. Decode (Num, "UTF-8 "));
Stu. setname (urldecoder. Decode (name, "UTF-8 "));
Stu. setclassname (urldecoder. Decode (classname, "UTF-8 "));
Generally, the struts filter is automatically processed in post. In get, this operation is required.
Principle:
Encodeuricomponent is a built-in JS function that converts special characters such as Chinese and Korean into UTF-8 URL encoding.
If encodeuricomponent is required to pass parameters to the backend, backend decoding is required to support UTF-8
Note that the encoding method in form is the same as that on the current page.