当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
面试必问的HashCode技术内幕
基于数据驱动的变电站巡检机器人自抗扰控制
LeetCode_279_完全平方数
以交易为生是一种什么体验?
SphereEx苗立尧:云原生架构下的Database Mesh研发实践
LeetCode_322_零钱兑换
An overview of the most useful DeFi tools
Difference between JSP out.print() and out.write() methods
利用“栈”快速计算——逆波兰表达式
JSP out.println()方法具有什么功能呢?
短视频SEO搜索运营获客系统功能介绍
使用 Zadig 交付云原生微服务应用
contentEditable属性
Play NFT summer: this collection of tools is worth collecting
Detailed explanation of Zadig's self-testing and tuning environment technical solution for developers
含外部储能的电力系统暂态稳定分布式控制
学习英语的网站与资料
【Leetcode】479. Largest Palindrome Product
07-SDRAM :FIFO控制模块
OpenCV DNN blogFromImage()详解









