Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

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

Comments

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