当前位置:网站首页>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
边栏推荐
猜你喜欢

短视频SEO搜索运营获客系统功能介绍

OpenCV DNN blogFromImage()详解

零基础如何学习单片机,一位入门者的进阶路径,可参考

How to reinstall Win11?One-click method to reinstall Win11

Double queue implementation stack?Dual stack implementation queue?

How to get the best power efficiency in Windows 11?

Win11如何获得最佳电源效率?

Play NFT summer: this collection of tools is worth collecting

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

security cross-domain configuration
随机推荐
After an incomplete recovery, the control file has been created or restored, the database must be opened with RESETLOGS, interpreting RESETLOGS.
【ACWing】230. 排列计数
JSP 如何获取request对象中的路径信息呢?
短视频SEO优化教程 自媒体SEO优化技巧方法
JSP out.println()方法具有什么功能呢?
Play NFT summer: this collection of tools is worth collecting
链上治理为何如此重要,波卡Gov 2.0又会如何引领链上治理的发展?
不就是个TCC分布式事务,有那么难吗?
基于注意力机制的多特征融合人脸活体检测
contentEditable属性
JSP内置对象out对象的功能简介说明
【Leetcode】473. Matchsticks to Square
NFT工具合集
JSP如何使用page指令让JSP文件支持中文编码呢?
08-SDRAM:汇总
els 方块变形判断。
短视频SEO搜索运营获客系统功能介绍
C语言七夕来袭!是时候展现专属于程序员的浪漫了!
基于超参数自动寻优的工控网络入侵检测
具有通信时延的多自主体系统时变参考输入的平均一致性跟踪