当前位置:网站首页>JSP how to obtain the path information in the request object?
JSP how to obtain the path information in the request object?
2022-08-02 00:18:00 【qq_25073223】
From:
http://www.java265.com/JavaCourse/202112/2060.html
The following author describes the method of obtaining the absolute path, virtual path and other information in the request object using the example method, as shown below:
Implementation ideas:Example 1: Project name "maomao"getContextPath(): Get the project nameResult: /maomaogetServletPath() Get the full name of the directory where the current page is located/maomao/jsp/test.jspgetRequestURL() gets the IE address bar addressResult: http://localhost:8080/maomao/testgetServletPath() gets the relative addressResult: /maomao/testExample 2: jsp request address: http://127.0.0.1:8080/projectName/test/testSearch.jsp, various paths are obtained as follows:request.getServletPath():/test/testSearch.jsprequest.getContextPath():/projectNamerequest.getRequestURL(): http://127.0.0.1:8080/projectName/test/testSearch.jsprequest.getRemoteAddr():127.0.0.1request.getServletContext():[email protected].getServerPort():8080request.getScheme():httprequest.getServerName():127.0.0.1request.getProtocol(): HTTP/1.1request.getPathInfo():nullrequest.getQueryString():null
边栏推荐
猜你喜欢

不了解SynchronousQueue?那ArrayBlockingQueue和LinkedBlockingQueue不会也不知道吧?

QML包管理

Short video SEO optimization tutorial Self-media SEO optimization skills and methods

Double queue implementation stack?Dual stack implementation queue?

一文概览最实用的 DeFi 工具

NFT工具合集
![[Headline] Written test questions - minimum stack](/img/67/08f2be8afc780e3848371a1b5e04db.png)
[Headline] Written test questions - minimum stack

Study Notes: The Return of Machine Learning

PHP从txt文件中读取数据的方法

图解LeetCode——1161. 最大层内元素和(难度:中等)
随机推荐
基于超参数自动寻优的工控网络入侵检测
GetHashCode与Equals
DOM 事件及事件委托
图解LeetCode——1161. 最大层内元素和(难度:中等)
GIF making - very simple one-click animation tool
Double queue implementation stack?Dual stack implementation queue?
Async/await principle and execution sequence analysis
Simpson's paradox
单片机遥控开关系统设计(结构原理、电路、程序)
security跨域配置
[头条]笔试题——最小栈
JSP内置对象out对象的功能简介说明
具有通信时延的多自主体系统时变参考输入的平均一致性跟踪
TCL: Pin Constraints Using the tcl Scripting Language in Quartus
Short video SEO optimization tutorial Self-media SEO optimization skills and methods
扑克牌问题
学习笔记:机器学习之回归
【Leetcode】473. Matchsticks to Square
中缀转后缀、前缀表达式快速解决办法
Statement执行update语句