Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@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);

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

@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);

Avatar

Community Advisor

@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.