当前位置: 代码迷 >> Web前端 >> 一点一滴-struts的action跳转后路径有关问题
  详细解决方案

一点一滴-struts的action跳转后路径有关问题

热度:42   发布时间:2012-08-01 17:53:41.0
一点一滴-struts的action跳转后路径问题
在使用action跳转后的页面路径如果是相对路径的话会出现css、js以及图片等无法加载问题。
 
解决方法:
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

在head标签中
<base href="<%=basePath%>">
  相关解决方案