FileDocCategorySizeDatePackage
LoginServlet.javaAPI DocExample1241Sat Mar 15 19:39:50 GMT 2003com.oreilly.javaxp.cactus.servlet

LoginServlet

public class LoginServlet extends HttpServlet
author
Brian M. Coyner $version $Id: LoginServlet.java,v 1.4 2003/02/27 00:24:43 jepc Exp $

Fields Summary
Constructors Summary
Methods Summary
protected voiddoPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)

        if (!validateParameters(req)) {
            req.setAttribute("errorMessage",
                             "Please enter your username and password");
            req.getRequestDispatcher("/login.jsp").forward(req, res);
            return;
        }

        // authenticate user
    
protected booleanvalidateParameters(javax.servlet.http.HttpServletRequest req)

        String username = req.getParameter("username");
        String password = req.getParameter("password");
        if ((username == null || "".equals(username)) ||
                (password == null || "".equals(password))) {
            return false;
        } else {
            return true;
        }