I have set my all files with UTF-8 format,so I set URIEncoding parameter in
server.xml,like follows:
<Connector port="8080" protocol="HTTP/1.1"
              maxThreads="150" connectionTimeout="20000"
              redirectPort="8443" URIEncoding="UTF-8"/>
Then I write a JSP file like follows:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:form method="post" action="test.do">
<s:textfield label="Name" name="Name"/>
<s:submit name="do"/>
</s:form>

In test.do action,I get the value of Name from JSP,like follows:
request.getParameter("Name");
System.out.println("Name="+Name);
If I input english name in the field Name in JSP,when I submit,the
test.dowill receive right english name,but when I input chinese name
in the field
Name in JSP,test.do will receive not right name,it will show [EMAIL PROTECTED]
I know it must be wrong in character change.But I don't want to change
URIEncoding from UTF-8 to GB2312 in the server.xml file,I guess I should do
something in test.do,but I don't know how to do it.
Anybody could tell me how to do it? Would you give me some code?

Thanks

Reply via email to