Two Laptop Bag
The moose likes Servlets and the fly likes FrontController and Servlet Filters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "FrontController and Servlet Filters" Watch "FrontController and Servlet Filters" New topic

FrontController and Servlet Filters

Ratheesh Narayanan
Ranch Hand

Joined: Oct 30, 2004
Posts: 38
Hi friends,

The problem which I am facing is slightly complex.

I have jsp page having many hyperlinks which request to a common Servlet (Front Controller). When the user clicks on a hyperlink the request forwards through another Servlet(Intercepting Filter). This Servlet checks whether the user has authenticated. If the user is not authenticated it shows a login page else the page which the user requested.

But the problem here is, once after the user authenticated from login page, he has to see the page which he had requested.

So what is the possible solution for this???

Please help me in this..

Thanks in advance,

Ratheesh narayanan

SCJP 1.4 & SCBCD 1.5
ak pillai
Ranch Hand

Joined: Feb 11, 2006
Posts: 288
If I could understand this correctly:

why not try:

1. Extract the requested URL from the request object (e.g. req.getRequestURL).

2. if already logged in then forward to to requested URL.

4. If not logged in then store the requested URL in the seesion, a hidden field,as query string or as a cookie and forward the user to the Login page.

5. If a session, hidden field or query string value exist for the requested URL, then forward (if no bookmark required)/sendRedirect (if bookmarking required) to the requested URL value stored in your session/hidden field. otherwise forward to your home page.

[ July 07, 2006: Message edited by: ak pillai ]

[ July 07, 2006: Message edited by: ak pillai ]
[ July 07, 2006: Message edited by: ak pillai ]

java j2ee job interview questions with answers | Learn the core concepts and the key areas
I agree. Here's the link:
subject: FrontController and Servlet Filters
It's not a secret anymore!