今天在做网站的时候,遇到这么一个问题:在jsp页面中引入js文件时,如果在jsp页面中写入相对路径,但是通过firebug的话,路径却是将根目录去掉之后的路径,可以这么解决:

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

<script type="text/javascript" src="<%=basePath%>dhtmlxscheduler/dhtmlxscheduler.js"></script>

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-03
  • 2021-07-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2021-11-29
  • 2022-12-23
相关资源
相似解决方案