struts2
结构能出来 只要页面刷新就会出现
2012-8-16 17:10:23 com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
严重: Error setting character encoding to 'true' - ignoring.
java.io.UnsupportedEncodingException: true
at java.lang.StringCoding.decode(StringCoding.java:170)
at java.lang.String.<init>(String.java:444)
at java.lang.String.<init>(String.java:516)
at org.apache.catalina.connector.Request.setCharacterEncoding(Request.java:1477)
at org.apache.catalina.connector.RequestFacade.setCharacterEncoding(RequestFacade.java:307)
at org.apache.struts2.dispatcher.Dispatcher.prepare(Dispatcher.java:659)
at org.apache.struts2.dispatcher.ng.PrepareOperations.setEncodingAndLocale(PrepareOperations.java:118)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:77)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)
struts.xml文件的配置
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.i18n.encoding" value="true"></constant>
<package name="struts2"
namespace="/"
extends="struts-default">
<action name="student" class="action.StudentAction">
<result>/student.jsp</result>
</action>
</package>
</struts>
------解决方案--------------------
有个配置encoding或java代码里
应该写
GBK
UTF-8
等才正确。
你写了true
------解决方案--------------------<constant name="struts.i18n.encoding" value="UTF-8"></constant>
------解决方案--------------------Java code
<constant name="struts.i18n.encoding" value="true"></constant>