In the doProcess() (doGet(), doPost()) method of your login servlet:

RequestDispatcher rd;

if( login) {
  rd = request.getRequestDispatcher( String success);
  rd.forward( request, response);
} else {
  rd = request.getRequestDispatcher( String error);
  rd.forward( request, response);
}

Where the String arguments are JSPs (recommended in your case), servlets,
static HTML pages, etc.

See, c.f.:
"Java Servlet Programming, 2d Ed." by Jason Hunter (O'Reilly, 2001):370-379;

"J2EE 1.3.1 API," javax.servlet.*


Mark

-----Original Message-----
From: Chetan Wagle [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 26, 2002 8:47 AM

Hi,

    This is a newbie question. I need to write this servlet (which I'd
like to call login.java). This servlet will be called when the user
visits my site and will initally display a login/password form asking
the user to authenticate himself. When the user hits the Submit button,
the form gets submitted to the same servlet which checks the username
and password for validity.

     In case the username/password don't match, the servlet displays an
error and asks the user to retry.

      My question is: If the username and password are found to be
correct, I would like to forward the user to another servlet that can
perform further processing. In other words, after performingthe
authentication, the user should be redirected to a new servlet. How can
I achieve this while still keeping the login functionality separate ?
Any ideas and hints will be appreciated.

Rgds,
Chetan

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to