Write a MyActionServlet and override the Process () method in the ActionServlet.
protected void process (HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, javax.servlet.ServletException {/ ** @ todo Override this org.apache.struts.action.ActionServlet method * / request.setCharacterEncoding ( 'GB2312') ; // add a line and do everything to solve super.process (Request, Response);
Of course, don't forget to change the configuration of Web.xml
This can solve the problem of garbled when the data is submitted, there is a garbled when the page is displayed.
<% response.setContentType ("text / vnd.wap.wml");%> or <% @ Page ContentType = "text / vnd.wap.wml; charSet = UTF-8"%>
In the JSP page, you should display the Chinese to add <% Request.setCharacterencoding ("UTF-8");%>