• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Processing a login page not working

 
Bartender
Posts: 1829
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the "response.sendRedirect('./index.jsp');",you need add two point like this "response.sendRedirect('../index.jsp');"
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 1829
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic