当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
els block deformation judgment.
当奈飞的NFT忘记了Web2的业务安全
Quick solution for infix to suffix and prefix expressions
基于超参数自动寻优的工控网络入侵检测
学习笔记:机器学习之回归
微软电脑管家V2.1公测版正式发布
bgp 聚合 反射器 联邦实验
【HCIP】BGP小型实验(联邦,优化)
学习英语的网站与资料
TCL:在Quartus中使用tcl脚本语言进行管脚约束
【Leetcode】1206. Design Skiplist
22. The support vector machine (SVM), gaussian kernel function
IP核:FIFO
含外部储能的电力系统暂态稳定分布式控制
Play NFT summer: this collection of tools is worth collecting
06-SDRAM :SDRAM控制模块
一文概览最实用的 DeFi 工具
TCL: Pin Constraints Using the tcl Scripting Language in Quartus
【Leetcode】470. Implement Rand10() Using Rand7()
22.支持向量机—高斯核函数








