File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Author

SessionServlet and Login.jsp

Kevin Weiss
Greenhorn

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:

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

Joined: Jan 10, 2002
Posts: 60057
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
shrikant patelin
Greenhorn

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
Greenhorn

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.
 
 
subject: SessionServlet and Login.jsp
 
Similar Threads
Problem With jsp:forward
user authentication and dao
Unable to Run Servlet
'The requested resource is not available' error
Jsp Login Page Problem