上struts2的xml在<result type="redirect">参数问题

时间:2024-04-16 13:37:52

今天做项目,我遇到了一个精彩的问题。

我需要在struts的xml中的<action>的<result>中配置type="redirect"。同一时候须要传參进去。试了老半天。我的别的參数都好着,就flag參数不好,纠结死了都快。后来,突然想想。改一下,说不定是什么keyword之类的,就把flag改成了showflag了。居然奇迹般的好了!

特此记录。有类似问题的大家还是不要直接写flag比較好。上struts2的xml在&lt;result type=&quot;redirect&quot;&gt;参数问题

<result name="success" type="redirect">test.action?id=${id}&amp;showflag=${showflag}</result>

<result name="error">/error.jsp</result>

注意:矿showflag在相应的action这是宣布。在该方法request.setAttribute走,在前景js接收${showflag}。