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.
Joined: Mar 09, 2006
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?
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;