File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes SessionServlet and Login.jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "SessionServlet and Login.jsp" Watch "SessionServlet and Login.jsp" New topic

SessionServlet and Login.jsp

Kevin Weiss

Joined: Jun 28, 2006
Posts: 5
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:



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
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63846

Basic debugging techniques: have you determined which branches through the code tree that your request is taking?

[Asking smart questions] [About Bear] [Books by Bear]
shrikant patelin

Joined: Jul 13, 2006
Posts: 1
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

Joined: Jun 28, 2006
Posts: 5
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.
I agree. Here's the link:
subject: SessionServlet and Login.jsp
jQuery in Action, 3rd edition