Stuts 中涉及编码配置相关 ..
- <%@ page language=”java” contentType=”text/html; charset=GBK”
- pageEncoding=”GBK”%>
- <%@ taglib prefix=”s” uri=”/struts-tags”%>
- <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd“>
- <html>
- <head>
- <meta http-equiv=”Content-Type” content=”text/html; charset=GBK”>
struts.locale=zh_CN |
- <!-- zh-cn encoding -->
- <filter>
- <filter-name>struts-cleanup</filter-name>
- <filter-class>
- org.apache.struts2.dispatcher.ActionContextCleanUp
- </filter-class>
- </filter>
- <filter-mapping>
- <filter-name>struts-cleanup</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- HttpServletResponse response = null;
- response = ServletActionContext.getResponse();
- request.setCharacterEncoding("utf-8");
- response.setContentType("text/html;charset=utf-8");
- String name = null;
- name = new String(name.getBytes("iso--8859-1"),"utf-8");
- 还有Tomcat 5.x 的那个版本出现码问题 纠结的N久 换成6.0 over 搞定。
- <Connector port="80" maxHttpHeaderSize="8192"
- maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
- enableLookups="false" redirectPort="8443" acceptCount="100"
- connectionTimeout="20000" disableUploadTimeout="true"URIEncoding="GBK"/>