web.xml 配置所有 JSP 文件引入 某个JSP

2017-08-13  本文已影响9人  郎中_大橙子

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);
%>
上一篇 下一篇

猜你喜欢

热点阅读