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。同时传递参数过去。