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
转载地址:http://blog.sina.com.cn/s/blog_6cbe0cff0101j6jl.html