您的位置:首页 > 编程语言 > Java开发

Struts2 Result Type

2016-02-24 14:04 393 查看
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>


5、r3.jsp
<body>
r3
</body>


6、r4.jsp

<body>
r4
</body>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: