File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Same Spring Controller, different Views Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Same Spring Controller, different Views" Watch "Same Spring Controller, different Views" New topic

Same Spring Controller, different Views

Javier Blazquez

Joined: Mar 10, 2012
Posts: 2

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.

Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

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.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Same Spring Controller, different Views
It's not a secret anymore!