1、web.xml
<!-- 所有的jsp文件都会引入 /WEB-INF/jsp/system/common.jsp -->
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<include-prelude>/WEB-INF/jsp/system/common.jsp</include-prelude>
</jsp-property-group>
</jsp-config>
2、common.jsp
<%
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
request.setAttribute("basePath", basePath);
%>
网友评论