jsp中获取WebContent路径

方法一:
 
  <script type= "text/javascript" src= "../js/data.js" ></script>
 
方法 2
<%
String path = request.getContextPath();
String basePath = request.getScheme()+ "://" +request.getServerName()+ ":" +request.getServerPort()+path+ "/" ;
%>
<script type= "text/javascript" src= "<%=path%>/js/data.js" ></script>


你可能感兴趣的:(Path)