struts2 anction跳转的一些方法

1、struts.xml 配置

 

<action name ="file_*" class="FileUploadAction" method='{1}'>
            <interceptor-ref name ="fileUploadStack" />
            <result name="constructFilePage">/pages/serviceManage/fileUpLoad.jsp</result>
            <!--result name="success" type="chain">file_constructFilePage </result-->
            <result name="success" type="redirect">file_constructFilePage.action </result>  (这种写法要加上.action)
 </action>

 

 

 

当type为chain 时,说明是action链,运行完第一个action java文件接着会运行第二个action JAVA 文件,相当于forward(客户端的url不会改变).当type为redirect-action时,说明会跳转到第二个action的url ,相当于redirect (客户端的url会改变)

 

2、后台action自执行跳转

 

例如:

 public void test(){

 

...

...

 

ServletActionContext.getResponse().sendRedirect("pages/serviceManage/serviceIndex.jsp?path="+npath);

 

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值