web.xml配置通用路徑的common.jsp

<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<% 
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
	request.setAttribute("basePath",basePath);
%>

在web.xml中配置commoon.jsp

    <!--爲所有的jsp引入common.jsp-->
    <jsp-config>
        <jsp-property-group>
            <url-pattern>*.jsp</url-pattern>
            <include-prelude>/WEB-INF/jsp/common.jsp</include-prelude>
        </jsp-property-group>
    </jsp-config>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章