@@ -0,0 +1,807 @@
+import java.io.*;  %0Aimport javax.servlet.*;  %0Aimport javax.servlet.http.*;  %0A  %0Apublic class LoginServlet extends HttpServlet %7B  %0A  %0A    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException %7B  %0A        String username = request.getParameter(%22username%22);  %0A        String password = request.getParameter(%22password%22);  %0A        // check username & password:  %0A        if(%22admin%22.equals(username) && %22123456%22.equals(password)) %7B  %0A            ServletContext context = getServletContext();  %0A            RequestDispatcher dispatcher = context.getNamedDispatcher(%22dispatcher%22);  %0A            dispatcher.forward(request, response);  %0A        %7D  %0A        else %7B  %0A            throw new RuntimeException(%22Login failed.%22);  %0A        %7D  %0A    %7D  %0A  %0A%7D  %0A

Create LoginServlet.java