This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi I have a LoginAction that should be executed when the user submits his name and password. The thing is that the user may arrive from many pages to this login page. what is the best way to forward him? i was thinking of creating a mid-form with jsp:forward tag. is there a way to do it in action class? because it has to return ActionForward and
Actions that forward, stream the response, etc. should return null.
Joined: Apr 16, 2008
The thing is that the user may arrive from many pages to this login page. what is the best way to forward him?
You could define one or more global forwards that go to each page that uses the login page.
Then include a hidden variable in the form (the one that user uses to submit name and password) that identifies which page is sending the request.
In the LoginAction, after authenticating the user, determine which page sent the request by reading the hidden variable and then using the global forward, get the user to any page you want them to go to. Sending them back to the page where they just entered their user name and password does not make any sense, however.
[ December 24, 2008: Message edited by: James Clark ]