一次Request請求只有一個值棧(Value Stack)。
Action才有Value Stack,JSP頁面沒有,如果在JSP頁面里想取參數值,可以從Stack Context中獲取。
因此,在result的type="redirect"時,如果有傳參數,可以從Stack Context中獲取。
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd"
>

<struts>
    
<constant name="struts.devMode" value="true" />

    
<package name="user" namespace="/user" extends="struts-default">
        
<action name="user" class="com.bebig.struts2.user.action.UserAction">
            
<!-- 用$符號來取Value Stack里的值 -->
            
<result type="redirect">/success.jsp?t=${type}</result>
        
</action>

    
</package>

</struts>
測試頁面代碼片斷:
<ul>
    success.
</ul>
<br>
<s:property value="t" />從Value Stack里取不到t的值,因為JSP頁面是沒有Value Stack的。
<br>
<s:property value="#parameters.t" />這里從Stack Context里取得t的值。
<s:debug></s:debug>