Joh*_*Wey 62
我们是这样做的:
在Struts.xml中,有一个动态结果,例如:
<result name="redirect" type="redirect">${url}</result>
Run Code Online (Sandbox Code Playgroud)
在行动中:
private String url;
public String getUrl()
{
return url;
}
public String execute()
{
[other stuff to setup your date]
url = "/section/document" + date;
return "redirect";
}
Run Code Online (Sandbox Code Playgroud)
您实际上可以使用相同的技术使用OGNL为struts.xml中的任何变量设置动态值.我们已经创建了各种动态结果,包括RESTful链接等.酷的东西.
小智 14
也可以使用annotations和Convention插件来避免struts.xml中的重复配置:
@Result(location="${url}", type="redirect")
Run Code Online (Sandbox Code Playgroud)
$ {url}表示"使用getUrl方法的值"
| 归档时间: |
|
| 查看次数: |
71003 次 |
| 最近记录: |