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

Detailed explanation of Zadig's self-testing and tuning environment technical solution for developers

众筹DAO“枯萎”的缩影:曾拍下《沙丘》未出版手稿的Spice DAO解散

不就是个TCC分布式事务,有那么难吗?

短视频seo搜索优化主要内容

信息系统项目管理师必背核心考点(五十七)知识管理工具

REST会消失吗?事件驱动架构如何搭建?

Quick solution for infix to suffix and prefix expressions

22.支持向量机—高斯核函数

中缀转后缀、前缀表达式快速解决办法

利用“栈”快速计算——逆波兰表达式
随机推荐
已知中序遍历数组和先序遍历数组,返回后序遗历数组
JSP request对象功能详解说明
【解决】win10下emqx启动报错Unable to load emulator DLL、node.db_role = EMQX_NODE__DB_ROLE = core
一篇永久摆脱Mysql时区错误问题,idea数据库可视化插件配置
解析正则表达式的底层实现原理
面试高频考题解法——栈的压入弹出序列、有效的括号、逆波兰表达式求值
07-SDRAM: FIFO control module
What is it like to trade for a living?
background-image使用
【三子棋】C语言实现简易三子棋
不就是个TCC分布式事务,有那么难吗?
【Leetcode】479. Largest Palindrome Product
基于编码策略的电网假数据注入攻击检测
电机原理动图合集
在不完全恢复、控制文件被创建或还原后,必须使用 RESETLOGS 打开数据库,解释 RESETLOGS.
扑克牌问题
基于注意力机制的多特征融合人脸活体检测
基于数据驱动的变电站巡检机器人自抗扰控制
Difference between JSP out.print() and out.write() methods
【无标题】