ITeye博客

跳转页面后CSS或JS失效问题

submaze · 2012-11-18 11:01 · UI · Web前端 · Markdown

主要是路径解析的问题

如果在页面中使用的不是绝对地址,例如 href="css/reset.css"

跳转后的页面要解析出正确的css地址,可以在jsp的中添加下面的代码



<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<base href="<%=basePath%>">


评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。