当前位置:网站首页>Servlet principle
Servlet principle
2022-06-30 06:51:00 【Sunny husband】
servlet server applet Small programs running on the server side
It's an interface , Specifies the java Class can be accessed by the browser ( By tomcat Server identification ) The rules of
Special that can be accessed by the browser java class , Must depend on web The server software can recognize and execute , It must abide by certain rules, that is, to achieve servlet Interface
servlet How it works
1. Browser access url http://localhost:8080/tomcat_1/demo1 , among localhost:8080 Find the corresponding server , tomcat_1 The corresponding items can be found for the virtual directory ,/demo1 For the resource path
2.tomcat The server will be from web.xml Search for url-pattern by /demo1 Configuration of
3. To find url-pattern by demo1 Of servlet-class( Full path of class )
4. Create objects of the class through reflection according to the full path of the class
5. Call its methods
servlet Life cycle of
1. establish init( Only once , By default, it is executed on the first access , It can also be executed when the server is started , Need to be revised web.xml In the label load-on-startup Value , Negative numbers are the default ,0 Or a positive number means that when the server starts )
2. service service( Each call will execute )
3. The destruction destroy ( Execute once before destruction )
servlet Annotation version configuration
There is no need for web.xml, Just add @WebServlet(“ Resource path ”) that will do . @WebServlet(“ Resource path ”) It's right @WebServlet(urlPatterns=“ Resource path ”) Abbreviation The premise is to write only this attribute , To configure multiple attributes, you need to write them all in sequence
边栏推荐
- Pycharm shortcut key
- leetcode:98. Validate binary search tree
- RT thread Kernel Implementation (VI): time slice
- MySQL优化:从十几秒优化到三百毫秒
- InnoDB engine in MySQL
- 随机网络,无标度网络,小世界网络以及NS小世界的性能对比matlab仿真
- Vscode returns the previous cursor (previous browse position)
- Deep learning --- the weight of the three good students' scores (3)
- 【json-tutorial】第一章学习笔记
- 【我的创作纪念日】一周年随笔
猜你喜欢
![[my creation anniversary] one year anniversary essay](/img/98/f9305894747687465f86354fe08500.png)
[my creation anniversary] one year anniversary essay

明天!“移动云杯”大赛空宣会开播!

第一行代码(第三版)学习笔记

1.6 - CPU组成

SOC_AHB_SD_IF

MySQL优化:从十几秒优化到三百毫秒

随机网络,无标度网络,小世界网络以及NS小世界的性能对比matlab仿真

记录一次腾讯测试开发工程师自动化接口测试实践经验

tomorrow! "Mobile cloud Cup" competition air publicity will start!

Judge whether H5 is in wechat environment or enterprise wechat environment at both ends
随机推荐
1.5 - 逻辑运算
[Hot100]10. 正则表达式匹配
阿里云买的40G高效云盘挂载只有20G
ROS system problem: rosdep init
【转】存储器结构、cache、DMA架构分析
[Hot100]回文子串 与 最长回文子串
不忘初心,能偷懒就偷懒:C#操作Word文件
0 basic job transfer software test, how to achieve a monthly salary of 9.5k+
First experience of Galaxy Kirin
leetcode:98. 验证二叉搜索树
相关数据库问题提问。
IO stream (file class introduction)
Solr search
Judge whether H5 is in wechat environment or enterprise wechat environment at both ends
【Hot100】11. 盛最多水的容器
It turns out that you are such an array. You have finally learned
SOC_ SD_ CLK
1.9 - 存储器的分类
写一个C程序判断系统是大端字节序还是小端字节序
Vscode returns the previous cursor (previous browse position)