链接:https://www.nowcoder.com/questionTerminal/3f368578e43d48b1968d79b935d00972
来源:牛客网

1.     service方法是在servlet生命周期中的服务期,默认在HttpServlet类中实现,根据HTTP请求方法(GET、POST等),将请求分发到doGet、doPost等方法实现。
2.1   GenericServlet
抽象类给出了设计servlet的一些骨架,定义了servlet生命周期还有一些得到名字、配置、初始化参数的方法,其设计的是和应用层协议无关的。
2.2   doget/dopost与Http协议有关,是在
javax.servlet.http.HttpServlet 中实现的。
3.    doGet和doPost方法在HttpServlet类中实现,GenericServlet中实现了service()
4.    常说所有的请求都先由service方法处理,而javax.servlet.GenericServlet接口实现了javax.servlet.Servlet接口,且javax.servlet.http.HttpServlet
是 javax.servlet.GenericServlet 的子类。只有最先定义好了的service方法才可以处理所有的请求。
5.   Servlet是线程不安全的,在Servlet类中可能会定义共享的类变量,这样在并发的多线程访问的情况下,不同的线程对成员变量的修改会引发错误

servlet service的描述:的更多相关文章

  1. Servlet.service() for Servlet jsp threw exception javax.servlet.ServletException:File "/pageFoo

    1.错误描述 Servlet.service() for Servlet jsp threw exception javax.servlet.ServletException:File "/ ...

  2. 报错:严重: Servlet.service() for servlet [jsp] in context with path [/20161116-Struts2-6] threw exception [/index.jsp (line: 13, column: 20) No tag "textfiled" defined in tag library imported with prefix

    严重: Servlet.service() for servlet [jsp] in context with path [/20161116-Struts2-6] threw exception [ ...

  3. 严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutputStream() has already been called

    错误: 严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutput ...

  4. 严重: Servlet.service() for servlet jsp threw exception java.lang.IllegalStateException: getOutputStream() has already been called for this response

    严重: Servlet.service() for servlet jsp threw exception    java.lang.IllegalStateException: getOutputS ...

  5. 报错!!!Servlet.service() for servlet [action] in context with path [/myssh] threw exception [java.lang.NullPointerException] with root cause java.lang.NullPointerException

    这个为什么报错啊~~ at com.hsp.basic.BasicService.executeQuery(BasicService.java:33) 这个对应的语句是   Query query = ...

  6. Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Unable to compile class for JSP] with root cause java.lang.IllegalArgumentException: Page directive: inval

    严重: Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Una ...

  7. Servlet.service() for servlet jsp threw exception

    报错信息如下: org.apache.catalina.core.ApplicationDispatcher invoke 严重: Servlet.service() for servlet jsp ...

  8. Servlet.service() for servlet UserServlet threw exception java.lang.NullPointerException 空指针异常

    错误付现: 严重: Servlet.service() for servlet UserServlet threw exceptionjava.lang.NullPointerException at ...

  9. 错误:严重: Servlet.service() for servlet [appServlet] in context with path [] threw exception [Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is

    严重: Servlet.service() for servlet [appServlet] in context with path [] threw exception [Request proc ...

随机推荐

  1. 使用Microsoft Office 2007将文档转换为PDF

    点击帮助 输入关键词PDF后搜索 点击进入Save or convert to PDF or XPS 点击进入2007 Microsoft Office Add-in: Microsoft Save ...

  2. CSS3 (一)

    属性选择器 1. E[attr^="value"]:指定了属性名,并且有属性值,属性值是以value开头的: .wrap a[href^="http://"]{ ...

  3. POJ 1737 Connected Graph(高精度+DP递推)

    题面 \(solution:\) 首先做个推销:带负数的压位高精度(加减乘+读写) 然后:由 \(N\) 个节点组成的无向图的总数为: \(2^{N*(N-1)/2}\) (也就是说这个图总共有 \( ...

  4. SimpleAdapter ArrayAdapter用法

    listView = (ListView) findViewById(R.id.list_main); /* String[] strings = {"A","A&quo ...

  5. SVN回滚机制

    引子 工作中遇到一个新同事提交代码时不知怎么的出现了大面积的代码覆盖,由于对SVN也不是特别了解,就看着别人处理问题,自己也验证性的实践了一下,总结一下. 总结 svn每一次提交成功,都会有一个`编号 ...

  6. import data from excel to sql server

    https://www.c-sharpcorner.com/article/how-to-import-excel-data-in-sql-server-2014/ 需要注意的是,第一次是选择sour ...

  7. [Selenium] 操作浏览器前进后退

    driver.get("http://1.com"); driver.navigate().to("http://2.com"); driver.navigat ...

  8. 【NOI 2015】软件包管理器

    [题目链接] 点击打开链接 [算法] 树链剖分,子树的DFS序也是连续的一段 要注意细节! [代码] #include<bits/stdc++.h> using namespace std ...

  9. bzoj2660最多的方案——数位DP

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=2660 首先,多种方案的出现是因为一个较大的斐波那契数可以变成两个较小的: 用一个01串来表示 ...

  10. 6-7 adaboost分类器1

    如何利用特征来区分目标,进行阈值判决.adaboost分类器它的优点在于前一个基本分类器分出的样本,在下一个分类器中会得到加强.加强后全体的样本那么再次进行整个训练.加强后的全体样本再次被用来训练下一 ...