首页 > Web开发 > 详细

JSP——常用配置-获取项目跟路径

时间:2017-11-14 12:22:27      阅读:297      评论:0      收藏:0      [点我收藏+]

将该内容放入一个空白的JSP文件中,保存为basepath.jsp,然后在需要引用的JSP文件中使用include标签引用。

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
request.setAttribute("basePath", basePath);
%>

 

JSP——常用配置-获取项目跟路径

原文:http://www.cnblogs.com/weilu2/p/jsp_config_basepath.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!