在JSP页面头部添加如下代码:
<% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %>
在引用资源前面添加如下代码:
<base href="<%=basePath%>"> <link rel="stylesheet" type="text/css" href="./resource/base.css"> <link rel="stylesheet" type="text/css" href="./resource/common.css">