struts2之action跳转到别的action同时传递参数
2018-03-06 16:09
330 查看
struts2 的action跳转到别的action时,可以使用redirectAction
如:
<action name="hr_emp" class="hrEmployeeAction">
<result name="loginForCustomer" type="redirectAction">./pages_crm/crm_cust</result>
</action>
如果还需要传递参数:
可以这样:
<action name="hr_emp" class="hrEmployeeAction">
<result name="loginForCustomer" type="redirectAction">
<param name="actionName">./pages_crm/crm_cust</param>
<param name="bwvobj.id">${customerId}</param>
</result>
</action>
在hrEmployeeAction中设置customerId属性,并有set和get方法。
public class HrEmployeeAction extends ActionSupport{
private String customerId;
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
.....
}
这样就可以通过struts2的action跳转到别的action。同时传递参数过去。
如:
<action name="hr_emp" class="hrEmployeeAction">
<result name="loginForCustomer" type="redirectAction">./pages_crm/crm_cust</result>
</action>
如果还需要传递参数:
可以这样:
<action name="hr_emp" class="hrEmployeeAction">
<result name="loginForCustomer" type="redirectAction">
<param name="actionName">./pages_crm/crm_cust</param>
<param name="bwvobj.id">${customerId}</param>
</result>
</action>
在hrEmployeeAction中设置customerId属性,并有set和get方法。
public class HrEmployeeAction extends ActionSupport{
private String customerId;
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
.....
}
这样就可以通过struts2的action跳转到别的action。同时传递参数过去。
相关文章推荐
- Struts2 action之间相互跳转传递参数
- Struts2 action之间相互跳转传递参数
- Struts2 使用annotation从action跳转到action并传递参数
- Struts2学习笔记1----Struts2框架action与view之间的参数传递小测试!
- Struts2—action参数传递
- Struts2中Action接收传递的参数
- struts2中的Action接收表单传递过来的参数有3种方法
- Struts2Action请求转发以及参数 拦截器传递参数
- struts2中的Action接收表单传递过来的参数有3种方法
- struts2中redirect action的参数传递
- struts2中Action参数传递之DTO
- Struts2中Action间参数传递
- struts2 action之间参数的传递
- struts2中redirect action的参数传递
- struts2中使用action属性传递参数
- struts2的action与jsp之间传递参数
- Struts2 使用域模型给action传递参数以及DTO
- Struts2--action接收参数传递的四种方式
- struts2整合uploadify插件实现批量上传,上传成功后跳转并传递参数
- struts2 后台action向前端JSP传递参数的问题