jsp页面中的path 与 bathPath区别
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
例如项目名称为: AAA 则
path为: /AAA
bathPath为 http://localhost:8080/AAA/
其中:
request.getScheme() 为: http
request.getServerName() 为: localhost
request.getServerPort() 为 :8080
需要返回某个页面时,可以添加如下链接
<a href="<%=basePath%>index.jsp">返回首页</a>