Struts2-如何从动作中动态重定向

时间:2017-05-04 04:53:21

标签: redirect struts2

我正在尝试重定向一些动态的动作,以便动态地将动态从动作重定向到struts.xml的最佳方法

示例:www.abc.com/employee/24/edit www.abc.com/employee/25/edit

1 个答案:

答案 0 :(得分:0)

<result name="redirect" type="redirect">employee/${employee_id}/edit</result>


  在行动中:

 private String employee_id;


//create getter & setter for employee_id

public String execute()
{
 Integer EmployeeId= .... //  do other stuff to get employee id 

 employee_id = EmployeeId;
 //this.employee_id=EmployeeId;
 return "redirect";
}