Package com. Atguigu. Login. Servlet;
import java.io.IOException;
The import javax.mail. Servlet. ServletException;
The import javax.mail. Servlet. HTTP. HttpServlet;
The import javax.mail. Servlet. HTTP. It;
The import javax.mail. Servlet. HTTP. HttpServletResponse;
/* *
* handle the login request to the Servlet
*
* the Servlet is set by the sun's standard, Tomcat (web application server and Servlet container) to achieve the standard.
*
* the HttpServlet;
*/
Public class LoginServlet extends the HttpServlet {
/* *
* the commonly used methods: doGet doPost service
* doGet: dealing with the client the way of the get request
*
* the doPost: deal with the request of the client's post way
*
* service: according to the specific request to call the corresponding doGet, doPost method
*/
@ Override
Protected void doGet (it the req, HttpServletResponse resp) throws ServletException, IOException {
The doPost (the req, resp);
}
@ Override
Protected void doPost (it the req, HttpServletResponse resp) throws ServletException, IOException {
The realization of the function of//login.
System. Out.println (" login request came over... ");
}
}
<? The XML version="1.0" encoding="utf-8"?>
The client request matching process:
With & lt; The servlet - mapping> The & lt; Url - pattern> Match, the matching to later, and then find & lt; The servlet - mapping>
The & lt; The servlet - name> Value, take the value to & lt; Servlet> Nodes in the matching of the same & lt; The servlet - name> To find the
Tomcat created by means of reflection LoginServlet instance, according to the request of the specific way to call the corresponding doGet or doPost method.
-->
LoginServlet
Com. Atguigu. Login. Servlet. LoginServlet
LoginServlet
/login