java web程序设计第3章.pptVIP

  • 9
  • 0
  • 约1.32万字
  • 约 50页
  • 2017-06-27 发布于浙江
  • 举报
第3章 深入Servlet技术 Java Web程序设计基础 3.1 Servlet概述 Servlet简介 Servlet工作流程 Servlet编程接口 Java Web目录结构 3.1.1 Servlet简介 Servlet是一种基于Java技术的Web组件,构建Web 应用程序的动态内容 Servlet容器,有时被称为Servlet引擎,是提供Servlet功能的Web服务器扩展组件 Servlet历史 3.1.2 Servlet工作流程 Servlet是建立在HTTP规范基础 GET表示查询信息,URL中可以附带少量的参数信息,但是URL总长度不能超过255个字符,并且参数会显示在浏览器地址栏。 POST表示提交信息,一般用于提交大数据信息或者文件,提交的内容不受长度限制,并且不会显示在浏览器地址栏。 HEAD表示查询文档头信息,服务器会返回文件类型、长度、最后修改时间等信息。该方式很少被使用。 OPTIONS、PUT、DELETE、TRACE属于被声明但没有被使用的Web访问方式。现在的浏览器中也很少使用到这几种方式。 客户与服务器交互 Servlet请求响应过程 用户请求了两个Servlet。接收到用户的请求后,Servlet1直接把内容反馈给了用户浏览器,Servlet2查询了数据库然后才把内容反馈给用户 3.1.3 Servlet编程接口 public abstract class HttpServlet extends GenericServlet implements Serializable { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; protected long getLastModified(HttpServletRequest request); protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; protected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; protected void doTrace(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException; protected void service(HttpServletRequest request, HttpServletResponse response)

文档评论(0)

1亿VIP精品文档

相关文档