View Single Post
  #17 (permalink)  
Old 04-09-2008, 11:49 AM
javarishi javarishi is offline
Member
 
Join Date: Apr 2008
Posts: 91
javarishi is on a distinguished road
Hei Lema,
I have a suggetion here. First You make a small design for your small application. As Far as I understood, your requirement seems to
be very easy one. Lets take an mvc approach. Create Two Jsps For User Interaction. One Servlet, One Class For Business Process.

So, login.jsp, welcome.jsp, wrongUser.jsp

LoginServlet,

and LoginAction

Totally You will Have Five Files.

In login.jsp, you collect the user data, and validate using javascript(optional)

make the form action as LoginServlet. In LoginServlet, you just retrieve the data from login.jsp, using request.getParameter(),

In LoginAction Classs You Create Two Methods, dbConnect(), for db connection, and verifyUser(), for userverification.

Write The Code In These methods.

In Login Servlet, just write the logic for redirecting user request. ie if user exists, redirect to welcome.jsp, otherwise, to wrongUser.jsp
Reply With Quote