日期:2014-05-18  浏览次数:20644 次

英文可以,中文不传参数不乱码Struts2->Result->type="redirect"->test2Su.jsp?username=${username}
<?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

------解决方案--------------------
可能是你服务器配置的URIEncoding不对
------解决方案--------------------
将 

<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" ?>