I'm developing a web site in which you can login from almost every page. The login action is the same to every page but always it must return to the page from which the action has been launched. My idea is to manage all the login request with the same controller (make it reusable) and depends on the page that called it, forward to it.
I don't know if it is possible or if there is another way to accomplish my requirements without having to "copy" the same action on each controller.
Or you can just use Spring Security and it does that automatically. So if you try to go to a URL you have secured, and you aren't logged in it will automatically send you to the login and redirect you to the page that was originally requested.