I’m trying to have my Struts2 app redirect to a generated URL. In this case, I want the URL to use the current date, or a date I looked up in a database. So /section/document becomes /section/document/2008-10-06
What’s the best way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s how we do it:
In Struts.xml, have a dynamic result such as:
In the action:
You can actually use this same technology to set dynamic values for any variable in your struts.xml using OGNL. We’ve created all sorts of dynamic results including stuff like RESTful links. Cool stuff.