jsp不能包含我的js文件

时间:2017-04-05 12:54:55

标签: javascript jsp

Web.xml中

<?xml version="1.0" encoding="UTF-8"?>
<web-app>
  <display-name>Ajax uploader</display-name>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <display-name>UploadFile</display-name>
    <servlet-name>UploadFile</servlet-name>
    <servlet-class>com.fileupload.UploadFile</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>UploadFile</servlet-name>
    <url-pattern>/UploadFile</url-pattern>
  </servlet-mapping>
    <security-constraint>
    <web-resource-collection>
       <web-resource-name>securedapp</web-resource-name>
       <url-pattern>*.jsp</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
       <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
</web-app>

JSP:

<script type="text/javascript" src="${request.contextPath}/includes/jquery.js"></script>
<script type="text/javascript" src="${request.contextPath}/includes/jquery.form.js"></script>
<script type="text/javascript" src="${request.contextPath}/includes/fileUploadScript.js"></script>

浏览器将$ {request.contextPath}视为文本,因此在查看源时:src =&#34; $ {request.contextPath}包含/ jquery.js&#34;

尝试src =&#34;包含/ jquery.js&#34;,但它提供了未找到的错误。
有什么想法吗?:)

0 个答案:

没有答案