• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SessionServlet and Login.jsp

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I'm trying to setup a simple session login JSP page servlet. Basically, I have the following files:
1) login.jsp
2) index.jsp
3) SessionLogin (Servlet)

What should happen is after success fully logging in (login.jsp uses SessionLogin Servlet) goes to the website index (index.jsp).

Everything compiles and runs fine, except the both doGet *and* doPost go to index.jsp...regardless if the username or password is right or wrong. I'm unsure what I doing wrong here.

Here are the file contents:

login.jsp



index.jsp


SessionLogin.java


Any help to get me in the right direction is much appreciated. Thanks in advance!

PS - I don't know if it matters, but I'm using netbeans 5.0, tomcat 5, postgresql 8.1
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basic debugging techniques: have you determined which branches through the code tree that your request is taking?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As seen in the login.jsp, u are not specifying whether Get or Post method should be used. So by default it is going to use Get method. The if u analyse the Get method u are always directing it to index.jsp. I doubt if Post method is getting called.
 
Kevin Weiss
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks everyone. I guess I just needed a break and some (obvious) advice. I changed the following lines of code:



Now it works as expected.
 
reply
    Bookmark Topic Watch Topic
  • New Topic