Is it possible to redirect user to "last visit page" after login ??

Avatar

Avatar

Adilmo

Avatar

Adilmo

Adilmo

24-09-2020

Is it possible to redirect user to "last visit page" after login ??

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Suraj_Kamdi

MVP

Avatar

Suraj_Kamdi

MVP

Suraj_Kamdi
MVP

24-09-2020

@Adilmo Yes, we can.

For that, You need to write a servlet that will store the current path of that page using the request parameter.

Once your user logged in to the from login page then redirect to the last path using

request.getRequestDispatcher(lastpPath);

Answers (1)

Answers (1)

Avatar

Avatar

Manjunath_K

Avatar

Manjunath_K

Manjunath_K

24-09-2020

@Adilmo 

Assuming you are referring to website page login & if 'yes' then try to save only the current page url (location.pathname) on page load of each page(except login page) in browser cookie as encrypted string/encoded URI. after login success event redirect to the page url  present in the cookie which will be the last visited page url.