当前位置:网站首页>Request and response objects
Request and response objects
2022-04-22 04:55:00 【Liang Yunliang】
request
-
type :HttpServletRequest
-
summary :request Equivalent to the browser sending a request message to the server , Package to request object . The object is created by the server , And send it to the in the form of parameters service() In the method , Finally, it was introduced into doGet() or doPost() In the method .
-
effect :
- Get request parameters
Example :
Page code
- Get request parameters
<a href="EndServlet?uname=zs&pwd=123456">\</a>
<form action="EndServlet" method="post">
user name :<input id="username" type="text" name="username" value="" /><br>
password :<input id="pwd" type="password" name="password" value="123"/><br>
<input id="btnSub" type="submit" value=" Sign in " >
</form>
- request.getParameter(): Get single request parameters
- request.getParameterValues(): Get multiple request parameters
-
Get the information in the request header
- request.getHeader(“User-Agent|Cookie|Referer”)
-
obtain URL Information 【http://localhost:8080/day06_servlet/】
- Get agreement :request.getScheme()
- Get the server name :request.getServerName()
- Get server port :request.getServerPort()
- Get context path 【 belt / Project name 】:request.getContextPath()
-
Forward the request 【 Path jump 】
//1. Get the transponder RequestDispatcher requestDispatcher = request.getRequestDispatcher("login_success.html"); //2. Perform forwarding requestDispatcher.forward(request,response); -
Domain object 【 There are four ,ServletContext|request】
response
- type :HttpServletResponse
- summary :response It is equivalent to the response message from the server to the browser , Package to response object . The object is created by the server , And send it to the in the form of parameters service() In the method , Finally, it was introduced into doGet() or doPost() In the method .
- effect :
- Get response flow , The response data
- PrintWriter writer = response.getWriter();
- writer.writer();|writer.print()
- Set the response header
- response.setHeader(“Content-Type”,“text/html;charset=UTF-8”);
- Redirect 【 Path jump 】
- response.sendRedirect(“url”);
- Get response flow , The response data
版权声明
本文为[Liang Yunliang]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210738414092.html
边栏推荐
- 【板栗糖GIS】supermap—如何为数据制造超链接
- How can devices of different brands be compatible and interconnected? Yiwen teaches you to understand
- [chestnut sugar GIS] ArcMap - how to make map combination table with buffer
- style/TextAppearance.Compat.Notification.Info) not found.
- 【板栗糖GIS】arcmap—模型构造器—批量裁剪栅格数据
- KNN, cross validation, grid search
- [chestnut sugar GIS] ArcMap - Model Builder - batch clipping grid data
- rpc error: code = Unavailable desc = error reading from server: EOF
- How to copy the variables in the chrome console as they are, save and download them locally
- Spark 入門程序 : WordCount
猜你喜欢

2022p cylinder filling test question bank and simulation test

Error encountered when installing opencv
![C language simple [stack and queue] (bracket matching problem)](/img/3d/092daf5d4896aabaf12d34497fe643.png)
C language simple [stack and queue] (bracket matching problem)

【板栗糖GIS】supermap—如何為數據制造超鏈接

How to realize different values and display different colors in MATLAB
![[SQL Server accelerated path] database and table (II)](/img/5a/cb54c5ca894820ab46b02d4c0ee346.png)
[SQL Server accelerated path] database and table (II)

2022a special equipment related management (elevator) test question simulation test question bank simulation test platform operation

kaggle实战4.1--时间序列预测问题

Carina local storage selected into the CNCF cloud native panorama
![[chestnut sugar GIS] SuperMap - how to create hyperlinks for data](/img/6d/8b46c96d3ec1005481919e5e81ce80.png)
[chestnut sugar GIS] SuperMap - how to create hyperlinks for data
随机推荐
2022a special equipment related management (elevator) test question simulation test question bank simulation test platform operation
CPU调用进程的方式
Win10 Caton repair
Convert a matrix into a sparse matrix, and then convert a sparse matrix into a matrix (Part I)
【Pytorch】torch. Bmm() method usage
Flutter安装总结
2022.04.20华为笔试
Wos opens the way, and Weimeng makes a new way for SaaS in China
Feature Engineering - feature preprocessing (normalization, standardization)
WAP picture
The simulation generates random numbers and calculates the birthday of each student
Bugly usage record
Es next related
Morphological operation of OpenCV image processing
[chestnut sugar GIS] ArcMap - how to combine multiple images into one
How can devices of different brands be compatible and interconnected? Yiwen teaches you to understand
Carina 的根基與誕生背景|深入了解 Carina 系列 第一期
不同品牌设备如何兼容实现互联?一文教你看懂
style/TextAppearance.Compat.Notification.Info) not found.
First knowledge of UI automation (inspect.exe + uiautomation)