@@ -0,0 +1,1488 @@
+package com.amzi.servlets;  %0A  %0Aimport java.io.IOException;  %0Aimport java.io.PrintWriter;  %0A  %0Aimport javax.servlet.RequestDispatcher;  %0Aimport javax.servlet.ServletException;  %0Aimport javax.servlet.http.HttpServlet;  %0Aimport javax.servlet.http.HttpServletRequest;  %0Aimport javax.servlet.http.HttpServletResponse;  %0Aimport javax.servlet.http.HttpSession;  %0A  %0Aimport com.amzi.dao.LoginDao;  %0A  %0Apublic class LoginServlet extends HttpServlet%7B  %0A  %0A    private static final long serialVersionUID = 1L;  %0A  %0A    public void doPost(HttpServletRequest request, HttpServletResponse response)    %0A            throws ServletException, IOException %7B    %0A  %0A        response.setContentType(%22text/html%22);    %0A        PrintWriter out = response.getWriter();    %0A          %0A        String n=request.getParameter(%22username%22);    %0A        String p=request.getParameter(%22userpass%22);   %0A          %0A        HttpSession session = request.getSession(false);  %0A        if(session!=null)  %0A        session.setAttribute(%22name%22, n);  %0A  %0A        if(LoginDao.validate(n, p))%7B    %0A            RequestDispatcher rd=request.getRequestDispatcher(%22welcome.jsp%22);    %0A            rd.forward(request,response);    %0A        %7D    %0A        else%7B    %0A            out.print(%22%3Cp style=%5C%22color:red%5C%22%3ESorry username or password error%3C/p%3E%22);    %0A            RequestDispatcher rd=request.getRequestDispatcher(%22index.jsp%22);    %0A            rd.include(request,response);    %0A        %7D    %0A  %0A        out.close();    %0A    %7D    %0A%7D   %0A

Create LoginServlet.java