servlet跳转页面导致css,js等失效的问题

来源:互联网 发布:游戏服务端数据库架构 编辑:程序博客网 时间:2024/04/29 04:33
这个问题困扰我好久了 一直没有找到比较合理的处理办法,今天无意识看到百度知道的一个回答
<%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%> <base href="<%=basePath%>">在jsp页面中加入这两句,以后只用写图片的名字就行了
没想到尽然ok了哦
原创粉丝点击