Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Processing a login page not working

 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a very simple login page that's not working as expected.

The idea is that if a user tries to access "premium content", he'll be redirected back to a login page. Currently, this page is just testing and not using any DB lookups:

Here's the login page code in the JSP:

This code "works" in that it does get the user name password and does the sendRedirect to index.jsp.

------

Then, back in index.jsp where the user got redirected after logging in, he should now be able to go to the premium content page, which has (test) verification code like this:


--------------------

The problem is that the code is always going back to the login page from the premium content page: the "loggedIn" session variable is not found.

These pages are separate JSP pages under a Tomcat Webapp.

What am I missing here?

Thanks in advance for any suggestions.

- Mike


[BPSouther: Added code tags]
[ March 31, 2008: Message edited by: Ben Souther ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing I would do, if I were debugging this, is use a System.out.print statement to print the value of your "loggedIn" session attribute.
 
Jun Wu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the "response.sendRedirect('./index.jsp');",you need add two point like this "response.sendRedirect('../index.jsp');"
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Mike London:
The problem is that the code is always going back to the login page from the premium content page: the "loggedIn" session variable is not found


It seems the session variable 'loggedIn' was not set in your previous page. I also would go with Ben's suggestion. Try doing it. :thumb:
 
Mike London
Ranch Hand
Posts: 1208
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all for all the replies!

The problem turned out to be a firewall issue related to "browser privacy". This issue only happens under certain circumstances.

Just found this a few minutes ago.

Thanks to all for the terrific replies and suggestions!!!



Mike
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's great Mike. Looks strange and i wonder how come it prevented this

Anyways thank you for posting back the resolution!

Cheers :thumb:
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic