struts处理中文乱码问题
web.xml
<filter>
<filter-name>struts2</filter-name>
<!--<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>-->
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Struts.xml
<struts>
<constant name="struts.devMode" value="true" />
<constant name="struts.il8n.encoding" value="GBK"/><!-- internationalization --> <package name="user" extends="struts-default" namespace="/user">
<action name="user" class="com.bjsxt.struts2.user.action.UserAction" method="add">
<result>/user_add_success.jsp</result>
</action>
<action name="user" class="com.bjsxt.struts2.user.action.UserAction">
<result>/user_add_success.jsp</result>
</action>
</package>
<!-- Add packages here -->
</struts>
UserAction.java
package com.bjsxt.struts2.user.action;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport {
private String name;
public String add() {
System.out.println("name=" + name);
return SUCCESS;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
出现问题:
2010-4-11 13:32:03 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: Could not find property [org.apache.catalina.jsp_file]
2010-4-11 13:32:20 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: Could not find property [struts.valueStack]
name=?绰2010-4-11 13:32:20 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: Could not find property [org.apache.catalina.jsp_file]
2010-4-11 13:35:02 org.apache.catalina.startup.HostConfig checkResources
信息: Reloading context [/Struts2_1000_CharacterEncoding]
2010-4-11 13:35:03 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-default.xml]
2010-4-11 13:35:04 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Unable to locate configuration files of the name struts-plugin.xml, skipping
2010-4-11 13:35:04 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts-plugin.xml]
2010-4-11 13:35:04 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Parsing configuration file [struts.xml]
2010-4-11 13:35:04 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Overriding property struts.i18n.reload - old value: false new value: true
2010-4-11 13:35:04 com.opensymphony.xwork2.util.logging.commons.CommonsLogger info
信息: Overriding property struts.configuration.xml.reload - old value: false new value: true
------解决方案--------------------
警告 可以无视。。。
com.opensymphony.xwork2.util.logging.commons.CommonsLogger
看一下这个类 是不是
找不到
org.apache.catalina.jsp_file
struts.valueStack
org.apache.catalina.jsp_file
这3个属性