File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Dynamic redirection in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynamic redirection in struts" Watch "Dynamic redirection in struts" New topic
Author

Dynamic redirection in struts

Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
I have been referred to this forum for this question.I hope for the best
We have a listings page which contain links for different actions.Each of those actions would require a user login before proceeding to the respective jsp page.

How do we dynamically pass in the input action/page to the login action.
On successul login,we need to redirect to that particular action/page from where the login action was triggered.

If this is not possible dynamically then we need to define separate actions for login from each of the page which requires a logged-in user.
Ranadhir Nag
Ranch Hand

Joined: Mar 09, 2006
Posts: 138
Just as a clarification,we can definitely store the requesting page on the sesiion object and redirect using requestdispatcher later.But that is more of a generic solution.
Does struts provide a better solution like modifying the input attribute dynamically?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Struts has no special features to handle this situation. Your best bet is to proceed as you have described: set the requested page in the session and when the user completes login, forward to that page if an entry exists.

One thing you may not be aware of is that you can dynamically create an ActionForward object and return that object from your Action class, rather than using the requestDispatcher. The code would be something like this:

ActionForward forward = new ActionForward("/mypage.jsp", false);
return forward;


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic redirection in struts