[Beginner] Servlet Servlet entry

Overview:

There are four Java Servlet API packages:

javax.servlet: Contract contains a definition between Servlet and Servlet Container classes and interfaces.

javax.servlet.http contains classes and interfaces defined in the contract between the HTTP Servlet and Servlet Container

javax.servlet.annotation contains Servlet, Filter and Listener To mark a comment. It also specifies metadata annotation element.

javax.servlet.descriptor contains type provides programmatic access to configuration information for a Web application.

 [Focus]

The core technology is the Servlet Servlet interface, which is a Servlet interface for all classes must be directly or indirectly to achieve.

Servlet interface defines a contract between Servlet and Servlet window. By this contract, Servlet container will Servlet class is loaded into memory, and the particular method call in the Servlet example.

In one application, each Servlet type only one instance.

 

Servlet life cycle [] init, service, destory

 

 

The other two non-Servlet life cycle approach: getServletConfig and getServletInfo

 

[Servlet application directory structure]

 

classes Servlet classes and other Java classes must be placed here. Directory below the class structure reflects the class package.

Here Servlet lib deploy applications required jar files. Servlet API jar files you do not need to deploy here, because Servlet container already contains these.

 

【ServletRequest】和【ServletResponse】

ServletRequest

 

Reproduced in: https: //www.cnblogs.com/IdealInverse/p/11012911.html

Guess you like

Origin blog.csdn.net/weixin_34119545/article/details/93512728