HttpServlet knowledge points in the first Servlet program

## HttpServlet is a subclass of GenericServlet

HttpServlet is a subclass of GennericServlet for receiving only Http request and response.
Typically, web development, need to use both Servlet can only achieve such,
servlet.http defined in the package using a class HttpServlet HTTP communication protocol,
HTTP request method includes the DELETE, GET, OPTIONS, POST, PUT , and the TRACE,
the HttpServlet class provides methods respectively corresponding service, they are,
doDelete (), the doGet (), doOptions (), the doPost (), doPut () and doTrace ().

HttpServlet container in response to client Web request process is as follows:

1) Web client issues a request to the Http Servlet container;

2) Servlet container Http request parsing the Web client;

3) Servlet container creates a HttpRequest object, the package Http request information in the object;

4) Servlet container creates an HttpResponse;

5) Servlet container calls the service method of HttpServlet,
the HttpRequest and HttpResponse object as a parameter passed to the service method HttpServlet objects;

6) HttpServlet call the relevant methods HttpRequest, access HTTP request information;

7) HttpServlet HttpResponse call related method of generating response data;

8) Servlet container to respond to the results of HttpServlet passed to Web clients.

Created the idea myeclipse and Servlet are by default inherited Service (), but does not show up,

Only need to rewrite get them, post is in the Servlet doGet (), doPost ()

Making a Form

 

 

In HTML

<form method="get  post" action="index.jsp(一般是servlet)">

There methed = get and methed = post two kinds

Setting get access address information is displayed, the equivalent of transmitting information in the form of a database

 

 

Set post information will be hidden, displayed in the form of address, but the data can also be transferred.

 

Guess you like

Origin www.cnblogs.com/blogwwx/p/12587357.html