<% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %>
使用
<%=basePath %>
jsp笔记----jsp常用的的获取项目的根路径
原文:http://www.cnblogs.com/tk55/p/7542310.html