struts2 redirect 配置動態傳遞參數

<action name="actionName" class="com.towerking.TestAction" method="executeMethod">
      <result name="success" type="redirect">login.jsp?flag=success&amp;userType=${userType}</result>
      <result name="error" type="redirect">login.jsp?flag=error&amp;userType=${userType}</result>
</action>

在配置Struts2的時候,有時須要配置多個參數,且其中一個參數是根據實際狀況動態變化的,則須要經過上述方法進行配置。jsp

其中在XML文件中,配置 & 須要使用spa

&amp;

不然Struts2會出現以下錯誤:struts2 the reference to entity must end with the ' ;' delimitercode

在配置代碼中userType的引用值,須要在對應的action中賦值,不然沒法獲取到。blog

相關文章
相關標籤/搜索