JSP中获取全路径

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

 

 

使用时:

<li><a href="<%=basePath%>admin/a">admin,继承user包</a></li>

你可能感兴趣的:(jsp)