链接: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. YTU 2456: 评委打分

    2456: 评委打分 时间限制: 1 Sec  内存限制: 128 MB 提交: 283  解决: 52 题目描述  一个歌唱比赛,比赛每次会从观众中随即抽取几名观众给分(观众至少有5个,分数为0~1 ...

  2. CodeForces546D:Soldier and Number Game(筛区间素数因子个数和)

    Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and giv ...

  3. 【HDU 4819】Mosaic

    [题目链接] 点击打开链接 [算法] 二维线段树(树套树) [代码] #include<bits/stdc++.h> using namespace std; #define MAXN 8 ...

  4. 【USACO】 Max Flow

    [题目链接] 点击打开链接 [算法] LCA + 树上差分 [代码] #include<bits/stdc++.h> using namespace std; int i,x,y,N,K, ...

  5. idea类名下有红色波浪线

    能编译通过说明SDK导入正确,但是为啥我们点击每一个Java文件会出现好多红色的下划线 ,并提示idea cant resolve symbol 原因就是可能没有清除原来的历史缓存,导致一些错误,解决 ...

  6. MySQL中的RAND()函数使用详解

    转自:https://www.jb51.net/article/66697.htm MySQL RAND()函数调用可以在0和1之间产生一个随机数: ? 1 2 3 4 5 6 7 mysql> ...

  7. BZOJ1787 meet

    题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1787 水题,但是结论很有趣. 题目求的是距离三个点之和最小的点. 这个很显然是在三个LCA上, ...

  8. C++开发工程师面试题库 50~100道

    51. New delete 与malloc free 的联系与区别?答案:都是在堆(heap)上进行动态的内存操作.用malloc函数需要指定内存分配的字节数并且不能初始化对象,new 会自动调用对 ...

  9. HDU 4542 小明系列故事——未知剩余系 (数论|反素数)

    分析 kuangbin的blog已经讲的很好了,我做一点补充 1.当做x*y>z的比较时,如果x \(\ast\) y过大,可以写成x>z/y 2.分解质因数时选择用f[][0]保存质数, ...

  10. bzoj 4240: 有趣的家庭菜园【树状数组+贪心】

    以为是逆序对数-- 实际上,原数组移动若干次后我们会得到一个新的下标序列,需要的移动次数是这个新下标序列的逆序对数 然后我们要让这个最小,考虑贪心先按h把下标排一遍序,然后每次询问到一种值的时候,对每 ...