request.getContextPath()
(2013-03-13 15:32:58)分类: java |
request.getContextPath()是在开发Web项目时,经常用到的方法,其作用是获取当前的系统路径。
getContextPath效果
2007年07月13日 星期五 下午 01:11
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
path IS: /jspSmartUpLoad
basePath IS:
request.getScheme() IS: http
request.getServerName() IS: yangm1203.oicp.net
request.getServerPort() IS: 8080