org.locomotive.module.base
Class LoginServlet

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--org.locomotive.loco.servlet.LocoServlet
                    |
                    +--org.locomotive.module.base.LoginServlet

public class LoginServlet
extends LocoServlet

A Sample login handling Servlet

See Also:
Serialized Form

Fields inherited from class org.locomotive.loco.servlet.LocoServlet
conn, DEBUG, ERROR, form_data, NORMAL, req, resp, session, steam_vars, url_tokens, user, WARNING
 
Constructor Summary
LoginServlet()
           
 
Method Summary
 void doGet(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          A GET simply shows the login page.
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)
          Takes the username and password entered from the HTML form and tries to log the user in.
protected  void handleFormSubmission()
          handle the login form submission.
 
Methods inherited from class org.locomotive.loco.servlet.LocoServlet
displayPage, displayString, handleException, log, logEvent, sayBadURL, service, setup
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doOptions, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoginServlet

public LoginServlet()
Method Detail

doGet

public void doGet(javax.servlet.http.HttpServletRequest req,
                  javax.servlet.http.HttpServletResponse resp)
           throws javax.servlet.ServletException,
                  java.io.IOException
A GET simply shows the login page.
Overrides:
doGet in class javax.servlet.http.HttpServlet

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse resp)
            throws javax.servlet.ServletException,
                   java.io.IOException
Takes the username and password entered from the HTML form and tries to log the user in.
Overrides:
doPost in class javax.servlet.http.HttpServlet

handleFormSubmission

protected void handleFormSubmission()
                             throws javax.servlet.ServletException,
                                    java.io.IOException
handle the login form submission. At the end, we should have a logged-in user, or else we'll redisplay the login form with error messages.