在使用Struts2开发时,有时需要用redirect 来跟多个参数,然而我们直接?param1=${a}¶m2=${b}。。是会被xml解析异常报错的,如下替换就可以了,
<action name="SectionInfo!*" method="{*}" class="docroad.action.apps.SectionInfo">
<result>/pages/apps/SectionInfo.jsp</result>
<result name="list" type="redirect">/Sections.do?appid=${appid}&pageNo=${pageNo}</result>
</action>
<action name="enterpreinfo" class="preinfoBusinessAction" method="enterPreinfoSub"> <result name="success" type="redirect-action"> showpreinfo?preinfo.order_number=${preinfo.order_number}&preinfo.company_name=${preinfo.company_name} </result> <result name="error" type="redirect"> <param name="location">/error.jsp</param> </result> </action>
多个参数的连接符使用了"&",但XML的语法规范,应该使用"&"代替"&",原理和HTML中的转义相同,开始没有注意,在struts分析配置文件时,总是报出这样的错误