<%@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>