java - jsp页面自动生成的basePath脚本,端口号后面为什么少一个"/"?
阿神
阿神 2017-04-17 16:09:40
[Java讨论组]
阿神
阿神

闭关修行中......

全部回复(2)
大家讲道理

打印下path 就知道了

黄舟

可以看下源码方法的说明文档。request.getContextPath()获取的是项目的上下文路径,是一个相对路径。是"/"开头的

  • Returns the portion of the request URI that indicates the context

    • of the request. The context path always comes first in a request

    • URI. The path starts with a "/" character but does not end with a "/"

    • character. For servlets in the default (root) context, this method

    • returns "". The container does not decode this string.

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号