To forward to a different application, you need to:
1-Specify a forward. In the path, specify the full URL of the site including the "http://". Also specify redirect="true".
2-Simply find the forward using the ActionMapping object and return it from the execute() method of your Action class, just as you would with any other forward.
And also what will happen to the Current session objects. will it get retained or get destroyed?
Naturally, since you're moving to a completely different application, the new application knows nothing about your session or any other objects stored on your server. If after browsing the new application, the user navigates back to your site, the session and all other server-side objects will still be there.
First, I saved the "dynamic" url in the session for later use in the Action object. Then, I just did the usual forward to another page called "redirect.jsp" from the Action object, using the predefined path attribute in the struts-config.xml file of course.
Then in the redirect.jsp page, I placed a JSTL redirect tag and gave it the value of the "dynamic" url I saved from the session previously.
Pretty hacky, but that solved the problem. Hope this helps somebody out too.
Joined: Jan 28, 2008
Great solution. I would like to suggest to save the URL in the request rather than the session, so that i won't be there in the memory after the redirect.