《Servlet学习笔记》Servlet 简介
2015-02-09 23:57
387 查看
Servlet 简介:
Servlet是sun公司提供的一门用于开发动态web资源的技术。
Sun公司在其API中提供了一个servlet接口,用户若想开发一个动态web资源(即开发一个Java程序向浏览器输出数据),需要完成以下两步:
1.编写一个Java类,实现servlet接口;
2.把开发好的Java类部署到web服务器中。
jsp就是servlet
javase、javaee,servlet不属于javase而属于javaee
servlet专门文档API
Tomcat可以运行servlet,lib里面有servlet的jar包
用记事本或UltraEdit编写java程序,用Java、javac编译运行
Servlet在线API:http://tomcat.apache.org/tomcat-5.5-doc/servletapi/
public interface Servlet
Defines methods that all servlets must implement.
A servlet is a small Java program that runs within a Web server. Servlets receive and respond to requests from Web clients, usually across HTTP, the HyperText Transfer Protocol.
To implement this interface, you can write a generic servlet that extends javax.servlet.GenericServlet or an HTTP servlet that extends javax.servlet.http.HttpServlet.
This interface defines methods to initialize a servlet, to service requests, and to remove a servlet from the server. These are known as life-cycle methods and are called in the following sequence:
The servlet is constructed, then initialized with the init method.
Any calls from clients to the service method are handled.
The servlet is taken out of service, then destroyed with the destroy method, then garbage collected and finalized.
In addition to the life-cycle methods, this interface provides the getServletConfig method, which the servlet can use to get any startup information, and the getServletInfo method, which allows the servlet to return basic information about itself, such as author, version, and copyright.
Method Summary
Servlet是sun公司提供的一门用于开发动态web资源的技术。
Sun公司在其API中提供了一个servlet接口,用户若想开发一个动态web资源(即开发一个Java程序向浏览器输出数据),需要完成以下两步:
1.编写一个Java类,实现servlet接口;
2.把开发好的Java类部署到web服务器中。
jsp就是servlet
javase、javaee,servlet不属于javase而属于javaee
servlet专门文档API
Tomcat可以运行servlet,lib里面有servlet的jar包
用记事本或UltraEdit编写java程序,用Java、javac编译运行
Servlet在线API:http://tomcat.apache.org/tomcat-5.5-doc/servletapi/
public interface Servlet
Defines methods that all servlets must implement.
A servlet is a small Java program that runs within a Web server. Servlets receive and respond to requests from Web clients, usually across HTTP, the HyperText Transfer Protocol.
To implement this interface, you can write a generic servlet that extends javax.servlet.GenericServlet or an HTTP servlet that extends javax.servlet.http.HttpServlet.
This interface defines methods to initialize a servlet, to service requests, and to remove a servlet from the server. These are known as life-cycle methods and are called in the following sequence:
The servlet is constructed, then initialized with the init method.
Any calls from clients to the service method are handled.
The servlet is taken out of service, then destroyed with the destroy method, then garbage collected and finalized.
In addition to the life-cycle methods, this interface provides the getServletConfig method, which the servlet can use to get any startup information, and the getServletInfo method, which allows the servlet to return basic information about itself, such as author, version, and copyright.
Method Summary
void | destroy() Called by the servlet container to indicate to a servlet that the servlet is being taken out of service. |
ServletConfig | getServletConfig() Returns a ServletConfigobject, which contains initialization and startup parameters for this servlet. |
java.lang.String | getServletInfo() Returns information about the servlet, such as author, version, and copyright. |
void | init(ServletConfig config) Called by the servlet container to indicate to a servlet that the servlet is being placed into service. |
void | service(ServletRequest req, ServletResponse res) Called by the servlet container to allow the servlet to respond to a request. |
相关文章推荐
- 《Servlet学习笔记》Servlet 简介
- servlet学习笔记(2)-servlet中得到cookie的信息(调试通过)
- Servlet简介
- Servlet简介 以及servlet一些细节 servletconfig servletcontext 的几个应用
- Servlet中的监听器简介
- Servlet简介-
- Servlet简介
- Servlet技术简介以及简单实践
- Servlet技术简介与编写、编译Servlet程序
- HttpServletResponse简介
- 04---servlet01(servlet简介)
- Servlet简介
- Servlet、servletConfig、ServletContext简介
- 【Servlet】(1)Servlet简介、Servlet底层原理、Servlet实现方式、Servlet生命周期
- servlet中session简介和使用例子
- Servlet简介
- Servlet3:简介AsyncContent
- Servlet学习 简介
- Servlet简介与Servlet和HttpServlet运行的流程
- Servlet第三篇【request和response简介、response的常见应用】