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

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -