当前位置:网站首页>Servlet core technology
Servlet core technology
2022-06-12 05:00:00 【なんでもないゃ】
C/S framework : client / Server mode , The client is responsible for the interaction with the user , The server is responsible for data management ;
B/S framework : browser / Server mode , The browser is responsible for interacting with users , The server is responsible for data management ;
JavaWeb:Web Web page , Here means the resources on the Internet for external access , It is divided into static resources and dynamic resources ,JavaWeb It's using Java Language goes on Web A general term for development , Is to solve related problems Web The sum of technologies in the field of Internet ;
HTTP agreement : Hypertext transfer protocol , Application layer protocol , Used to regulate browsers and Web The data format of how servers communicate , It mainly involves the request format of the browser and the response format of the server ;
HTTP Request format : Request line 、 Request header 、 Blank line 、 Request body ;
HTTP The response format : Corresponding line , Response head , Blank line , Response body ;
Press F12 Key to view request and response information ;
Tomcat The default access is ROOT In the catalog index.html, Manual access is hostlocal:8080/ Directory name 、 file name ;
Servlet Is a class that runs on the server , Can respond to requests from browsers ;
Servlet There are three programming steps :
Servlet Life cycle of :
| Instantiation | Servlet Container to create Servlet Example , First request Servlet Call the constructor to create Servlet example , Call it once |
| initialization | The container calls init() Method , The method Call it once , When creating a good Servlet The method is called immediately after the instance Servlet The initialization |
| service | If you ask for Servlet, Then the container calls service() Method ,service() Method is used multiple times call , Whenever there is a request, it will call service() Method for the response to the request |
| The destruction | Call before destroying instance destory() Method , This method is only used by Call once , When it's time to Servlet Instance Web The application calls the method before releasing it to release the resources currently occupied. |
| Unavailable | Destroy the instance and mark it for garbage collection |
GET There are three ways to request : Type in the browser URL Press enter ;
Click on <a> Hyperlinks ,<a href="hello4"> test Get request </a>;
Click on submit Button , Submit <form method="get"> Forms ;
<form action="hello4" method="get">
<input type="submit">
</form>GET Request characteristics : The requested data will be added to URL After the address , Only a small amount of data can be submitted , unsafe ;
POST Request mode : Click on submit Button , Submit <form method="get"> Forms ;( multi-purpose )
<form action="hello4" method="post">
<input type="submit">
</form>POST Request characteristics : Request data to be added to HTTP Agreement , A large amount of data can be submitted , Good safety ;
ServletRequest The interface is mainly used to provide servlet Provide client request information , You can get any request information from ;
HttpServletRequest Interface is SercletRequest Sub interface of , Mainly used to provide HTTP The function of requesting information ;
Servlet Receive Chinese garbled code : When the browser submits the form , Chinese parameter values will be automatically encoded , When Tomcat The server automatically decodes after receiving the browser request , When the encoding method is inconsistent with the decoding method, it will lead to garbled code ;

ServletResponse Interface is used to define an object to help Servlet Send a response to the client ;
HttpServletResponse The interface provides a response specific to HTTP The function of ;
ServletConfig Interfaces are used to describe Servlet Relevant configuration information of itself , Used to pass information to during initialization Servlet Configuration object ;
ServletContext Interfaces are used to define a set of methods ,Servvlet Use these methods with its Servlet Vessel communication ;
边栏推荐
- 2022 fusion welding and thermal cutting recurrent training question bank and simulation examination
- one billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven
- Pupanvr- establishment of development environment and diary, addition of some basic tool functions (3)
- Summary of common interview questions in redis
- The master programmer "plays" a C program that is not like C
- Design of a simple embedded web service application
- Sword finger offer30 days re brush
- [cjson] precautions for root node
- National land use data of 30m precision secondary classification
- JS to determine whether the tags of multiple classes are empty
猜你喜欢

How to deploy PostgreSQL as a docker container

Drive safety coding & troubleshooting guide

Token based authentication

1009 word search

Ten trends of Internet Security in 2022 industry released

L1-067 Roche limit (10 points)

L1-066 cat is liquid (5 points)
![February 19, 2022 [Nolan] Nolan resurrected? Change · Nolan [soul orchid] can be connected to XDD / silly girl](/img/1a/ab2158a532683632f3a12fe41812f5.jpg)
February 19, 2022 [Nolan] Nolan resurrected? Change · Nolan [soul orchid] can be connected to XDD / silly girl

National land use data of 30m precision secondary classification

cellular automaton
随机推荐
cellular automaton
Spatial distribution data of China's tertiary watershed / national new area distribution data /npp net primary productivity data / spatial distribution data of vegetation cover / land use data /ndvi d
L1-065 "nonsense code" (5 points)
Google reinforcement learning framework seed RL environment deployment
2022 low voltage electrician test questions and simulation test
How to generate provincial data from county-level data in ArcGIS?
LabVIEW about TDMS and binary storage speeds
Pupanvr- an open source embedded NVR system (1)
Big manufacturers compete to join rust, performance and safety are the key, and the 2021 rust developer survey report is announced
Common MySQL date query
[backtracking method] backtracking method to solve the problem of Full Permutation
Drive safety coding & troubleshooting guide
one billion one hundred and eleven million one hundred and eleven thousand one hundred and eleven
Link: fatal error lnk1168: cannot open debug/test Solution of exe for writing
The third "World War" - chip defense, smokeless battlefield!
1008 color classification
Day17 array features array boundary array application traversal array multidimensional array creation and traversal arrays operation array bubble sort
[cjson] precautions for root node
Ten trends of Internet Security in 2022 industry released
kali下安装pycharm并创建快捷访问