<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd"><struts>
<include file="struts-default.xml"/>
<package name="Xhgs" namespace="/Xhgs" extends="struts-default">
<action name="test1" class="xhgs.yym.Test1Action">
<result type="chain">
<param name="namespace">/Xhgs</param>
<param name="actionName">test2</param>
<param name="method">execute</param>
</result>
</action>
<action name="test2" class="xhgs.yym.Test2Action">
<result name="success" type="redirect">/test2Suc.jsp?username=${username}</result>
</action>
</package>
</struts>
英文能够正常传参数:http://192.168.1.102/tutorial/test2Suc.jsp?username=zheshicanshu
中文不传参数不乱码:http://192.168.1.102/tutorial/test2Suc.jsp?username=redirect
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd"><struts>
<include file="struts-default.xml"/>
<package name="Xhgs" namespace="/Xhgs" extends="struts-default">
<action name="test1" class="xhgs.yym.Test1Action">
<result type="chain">
<param name="namespace">/Xhgs</param>
<param name="actionName">test2</param>
<param name="method">execute</param>
</result>
</action>
<action name="test2" class="xhgs.yym.Test2Action">
<result name="success" type="redirect">/test2Suc.jsp?username=${username}</result>
</action>
</package>
</struts>
英文能够正常传参数:http://192.168.1.102/tutorial/test2Suc.jsp?username=zheshicanshu
中文不传参数不乱码:http://192.168.1.102/tutorial/test2Suc.jsp?username=redirect
把原文件中:<result name="success" type="redirect">/test2Suc.jsp?username=${username}</result>
改为: <result name="success" type="redirect
<param name="location">/test2Suc.jsp</param>
<param name="username">${username}</param>
</result>
这样写,“中文”参数就传进去了。但我还是纳闷,原文中“中文”怎么就传不进去呢?
<action name="test1" class="xhgs.yym.Test1Action">
//改为
<action name="test1" class="xhgs.yym.Test1Action" method="post">
//
<?xml version="1.0" encoding="UTF-8" ?>
//改为
<?xml version="1.0" encoding="GBK" ?>