Reply to
:
How are you redirecting to the login page? At that point you should store the originally requested URL somewhere (can be in session, or request param that you pass around) such that you can redirect back there after he logs in again
I redirect to the login page through a filter, but I can’t store the url in the session or request param because session time out, I can store it in local storage, but there are many websites redirect to the page I was already on without using local storage!
If you forward to the login page instead of redirect (using requestDispatcher.forward), you can retain any attributes saved into the request. In this way you can store the original url as a request attribute and add it as a hidden field in your login jsp
If you enjoyed my content for some reason, I'd love to hear from you! Here are some options:
- You can buy me a coffee!
- You can write a reply on your own site and submit the URL as a webmention via the form below.
- Or you can just contact me!