java - How to do dynamic URL redirects in Struts 2? -
i'm trying have struts2 app redirect generated url. in case, want url use current date, or date looked in database. /section/document
becomes /section/document/2008-10-06
what's best way this?
here's how it:
in struts.xml, have dynamic result such as:
<result name="redirect" type="redirect">${url}</result>
in action:
private string url; public string geturl() { return url; } public string execute() { [other stuff setup date] url = "/section/document" + date; return "redirect"; }
you can use same technology set dynamic values variable in struts.xml using ognl. we've created sorts of dynamic results including stuff restful links. cool stuff.
Comments
Post a Comment