Redirecting user to Login page & then resuming on the same page
posted 8 years ago
I am currently using Spring MVC in conjunction with JSR168 Portlets. So the view in this case is JSR-168 portlet. I am developing this JSR-168 portlet to be rendered. On receiving a request in my SpringController class I check if user credentials are available. If yes I proceed with the rendering of the JSR 168 portlet page.
But suppose the user is not logged in, I want to redirect the user to the login page where in if the user is a registered user when he enters his credentials the user should resume on the page(ie.JSR168 portlet page) which he was trying to access but could not because of invalid credentials.
Also in the login page there is a register link. So in case the user is not registered I want the user to register & be redirected to the same page which he was trying to access at the onset that being the JSR168 portlet page.
I am kind of new to Spring. Do i have to take care of this at the Login & register pages or do I need to do something at the JSR portlet page I am developing. Is it that i need to pass the reference of the URL to the login & register page so when the user actually logs in they get redirected to the required URL (i.e.the JSR 168 portlet page I am developing)
Kindly post your suggestions on how do I go about implementing the same.