GeeCON Prague 2014*
The moose likes Servlets and the fly likes Keep getting Redirected to my Login Page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Keep getting Redirected to my Login Page" Watch "Keep getting Redirected to my Login Page" New topic
Author

Keep getting Redirected to my Login Page

Dean Chester
Ranch Hand

Joined: Jul 26, 2009
Posts: 31
Hi
I have written this filter for my application that redirects you to my login.jsp page if the user is not logged in. Yet all the restriced areas redirect me to the login page no matter here if the seesion is valid or not, then once logged in your are directed to the logged in home page. Here is the source for my filter:

Here is part of my web.xml file:

So if anyone can help i would be grateful
Thanks in advance
liZard12
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,

Can't see anything in that, can you post the login part that saves the user into the session?

Sean


I love this place!
Dean Chester
Ranch Hand

Joined: Jul 26, 2009
Posts: 31
Here you go:
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Again, nothing is jumping out.

Is the values that you are getting from the database definitely not null?
That's about the only thing I can think of.
Dean Chester
Ranch Hand

Joined: Jul 26, 2009
Posts: 31
Sean Clark wrote:Again, nothing is jumping out.

Is the values that you are getting from the database definitely not null?
That's about the only thing I can think of.


Your right the value is null i don't know why as it didn't display anything when i put something in the page that you get redirected to when you log in. Yet the username is set and printed out later in the code which gets it from the session.
Dean Chester
Ranch Hand

Joined: Jul 26, 2009
Posts: 31
Sorry i made a mistake the attribute is getting set.
Dean Chester
Ranch Hand

Joined: Jul 26, 2009
Posts: 31
Thanks to everyone that has tried to help. I am now managing the sessions manually in a database and a cookie which works reasonably well just very slow on my testing set up but when deployed it works quicker as the database is local and not on the other side of the work.
Dean
 
GeeCON Prague 2014
 
subject: Keep getting Redirected to my Login Page