需要驗證是否有以下錯誤.
是 get 還是 post 傳參
1. 第四個可能性就是在web.xml中需要設(shè)置一個Filter ,將編碼設(shè)置成utf-8
<!-- STRUTS2 utf-8 -->
<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>
2. 第一個可能性是顯示的jsp里面的content-type要設(shè)置對.
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
3. 第二個就是jsp文件的編碼需要是ASCII編碼形式
4. 第三個就是應(yīng)用服務(wù)器的版本, 如果是tomcat 的話,5.5版本后需要在每個頁面都設(shè)置
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
在server.xml中
<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000" useBodyEncodingForURI="true"
disableUploadTimeout="true" URIEncoding=”UTF-8”/>
加上就可以.
如果還有問題可能就是數(shù)據(jù)庫的問題.
數(shù)據(jù)庫的連接字符串需要設(shè)置對.
是 get 還是 post 傳參
1. 第四個可能性就是在web.xml中需要設(shè)置一個Filter ,將編碼設(shè)置成utf-8
<!-- STRUTS2 utf-8 -->
<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>
2. 第一個可能性是顯示的jsp里面的content-type要設(shè)置對.
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
3. 第二個就是jsp文件的編碼需要是ASCII編碼形式
4. 第三個就是應(yīng)用服務(wù)器的版本, 如果是tomcat 的話,5.5版本后需要在每個頁面都設(shè)置
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
在server.xml中
<Connector port="8080"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000" useBodyEncodingForURI="true"
disableUploadTimeout="true" URIEncoding=”UTF-8”/>
加上就可以.
如果還有問題可能就是數(shù)據(jù)庫的問題.
數(shù)據(jù)庫的連接字符串需要設(shè)置對.