Struts2 Result Type
1、struts.xml
<struts> 
 <constant name="struts.devMode" value="true" />
 <package name="resultTypes" namespace="/r" extends="struts-default">
        
        <action name="r1">
            <result type="dispatcher">/r1.jsp</result>
        </action>
        <action name="r2">
            <result type="redirect">/r2.jsp</result>
        </action>
        <action name="r3">
            <result type="chain">r1</result>
        </action>
        <action name="r4">
            <result type="redirectAction">/r2</result>
        </action>
    </package>    
</struts>2、index.jsp
<body> Result类型 <ol> <li><a href="r/r1">dispatcher</li> <li><a href="r/r2">redirect</li> <li><a href="r/r3">chain</li> <li><a href="r/r4">redirectAction</li> <li>freemarker</li> <li>httpheader</li> <li>stream</li> <li>velocity</li> <li>xslt</li> <li>plaintext</li> <li>tiles</li> </ol> </body>
3、r1.jsp
<body> r1 </body>
4.r2.jsp
<body> r2 </body>
<body> r3 </body>
<body> r4 </body>
 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号