This is the servlet.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
public class ChicoServlet extends HttpServlet
{
private void sendLoginForm(HttpServletResponse response, boolean withErrorMessage)
throws ServletException,IOException
{
response.setContentType("text/html"

;
PrintWriter out =response.getWriter();
out.println("<HTML>"

;
out.println("<HEAD>"

;
out.println("<TITLE>Login</TITLE>"

;
out.println("</HEAD>"

;
out.println("<BODY>"

;
/* check if we have an error */
if (withErrorMessage)
{
out.println("Login failed.Please try again.<BR>"

;
}
out.println("<BR>"

;
out.println("<BR>Please enter your user name and password."

;
out.println("<BR><FORM METHOD=POST>"

;
out.println("<BR>User Name:<INPUT TYPE=TEXT NAME=userName>"

;
out.println("<BR>Password:<INPUT TYPE=PASSWORD NAME=password>"

;
out.println("<BR><INPUT TYPE=SUBMIT VALUE=Submit>"

;
out.println("</FORM>"

;
out.println("</BODY>"

;
out.println("</HTML>"

;
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException
{
sendLoginForm(response,false);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException,IOException
{
/* get the user name and password */
String userName = request.getParameter("userName"

;
String password = request.getParameter("password"

;
if (userName != null && password != null && userName.equals("chico"

&& password.equals("desperado"

)
{
// Load Driver
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"

;
}
catch(ClassNotFoundException cnfe)
{
System.err.println("Error loading driver: " + cnfe);
}
/* Define the connection url */
String url = "jdbc

dbc:NorthwindJava";
try
{
/* Stablish the connection */
Connection dbconn = java.sql.DriverManager.getConnection(url, "xxx", "xxx"

;
/* create a statement */
Statement stmt = dbconn.createStatement();
/* Create a result set */
ResultSet searchResultsList = stmt.executeQuery("Select FirstName, LastName, Title, Address from Employees order by LastName,FirstName"

;
RequestDispatcher disp;
disp = getServletContext( ).getRequestDispatcher("/Chico.jsp"

;
request.setAttribute("search.results", searchResultsList);
disp.forward(request, response);
}
catch(SQLException cnfe)
{
/* display a error to the user -- can't connect to DB */
System.err.println("Error connecting to the dtatase: " + cnfe);
}
}
else
{
sendLoginForm(response,true);
}
}
}