链接: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. RSA前端JS加密,后端JAVA解密实现

    用RSA非对称加密方式实现.后台生成rsa密钥对,然后在页面设置rsa公钥,提交时用公钥加密密码,生成的密文传到后台,后台再用私钥解密,获取密码明文.这样客户端只需要知道rsa加密方式和公钥,前台不知 ...

  2. spring cloud - config 属性自动刷新

    启动config-server,启动成功后就不需要在管了; 在config-client做些修改: 在使用的controller或service的类上加上一个注解@RefreshScope 在pom中 ...

  3. HDU4283 You Are the One —— 区间DP

    题目链接:https://vjudge.net/problem/HDU-4283 You Are the One Time Limit: 2000/1000 MS (Java/Others)    M ...

  4. html5--3.2 input元素(2)

    html5--3.2 input元素(2) 学习要点 input元素及其属性 input元素 用来设置表单中的内容项,比如输入内容的文本框,按钮等 不仅可以布置在表单中,也可以在表单之外的元素使用 i ...

  5. HDU - 1054 Strategic Game(二分图最小点覆盖/树形dp)

    d.一颗树,选最少的点覆盖所有边 s. 1.可以转成二分图的最小点覆盖来做.不过转换后要把匹配数除以2,这个待细看. 2.也可以用树形dp c.匈牙利算法(邻接表,用vector实现): /* 用ST ...

  6. cassandra cpp driver中bind list——用cass_statement_bind_collection函数

    CassError insert_into_collections(CassSession* session, const char* key, const char* items[]) { Cass ...

  7. 随机生成50个字段的elasticsearch的测试程序输入

    词典位置:https://raw.githubusercontent.com/jonbcard/scrabble-bot/master/src/dictionary.txt import json f ...

  8. mysql 5.5升级到5.7版本操作流程

    一.备份原来 phpStudy 中 MySQL 安装目录 二.把下载的 MySQL 压缩文件解压至 phpStudy 下的 MySQL目录,复制 my-default.ini ,重命名为 my.ini ...

  9. ubuntu安装wine+plsql

    1.在ubuntu下装了win7的虚拟机,在使用plsql进行开发的时候发现很慢很卡,经常半天反应不过来.机器是不差的,1w5的thinkstation,实在受不了这种 速度,想着在ubuntu下搞一 ...

  10. async-await原理解析

    在用async包裹的方法体中,可以使用await关键字以同步的方式编写异步调用的代码.那么它的内部实现原理是什么样的呢?我们是否可以自定义await以实现定制性的需求呢?先来看一个简单的例子: cla ...