• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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: 67595
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.
 
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