JBoss资源位置

时间:2013-10-14 20:26:55

标签: java-ee jboss jboss7.x

我正在尝试将JavaScript文件加载到我的jsp文件

这是我尝试过的:

<script type="text/javascript"  src="static/js/jquery-ui-1.10.3.custom.js"></script>
<script type="text/javascript"  src="/static/js/jquery-ui-1.10.3.custom.js"></script>

<script type="text/javascript"  src="/WebContent/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"></script>
<script type="text/javascript"  src="WebContent/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"></script>

<script type="text/javascript"  src="/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"></script>
<script type="text/javascript"  src="WEB-INF/static/js/jquery-ui-1.10.3.custom.js"></script>

<script type="text/javascript"  src="/USI-WEB/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"></script>
<script type="text/javascript"  src="/USI-WEB/WebContent/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"></script>

<script type="text/javascript"  src="USI-WEB/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"></script>
<script type="text/javascript"  src="USI-WEB/WebContent/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"></script>

<script type="text/javascript"  src="<%=request.getContextPath() + "/static/js/jquery-ui-1.10.3.custom.js"%>"></script>
<script type="text/javascript"  src="<%=request.getContextPath() + "/static/js/jquery-ui-1.10.3.custom.js"%>"></script>

<script type="text/javascript"  src="<%=request.getContextPath() + "/WebContent/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"%>"></script>
<script type="text/javascript"  src="<%=request.getContextPath() + "WebContent/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"%>"></script>

<script type="text/javascript"  src="<%=request.getContextPath() + "/WEB-INF/static/js/jquery-ui-1.10.3.custom.js"%>"></script>
<script type="text/javascript"  src="<%=request.getContextPath() + "WEB-INF/static/js/jquery-ui-1.10.3.custom.js"%>"></script>

This is my project structure

This is the file location

这是我的web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>USI WEB</display-name>

  <!-- Filter to set character encoding on each request -->


  <servlet>
    <servlet-name>Servlet</servlet-name>
    <servlet-class>usi.servlet.Servlet</servlet-class>
  </servlet>


  <welcome-file-list>
    <welcome-file>Servlet</welcome-file>
  </welcome-file-list>
</web-app>

关于这一切,我得到:The requested resource () is not available.

2 个答案:

答案 0 :(得分:1)

找到解决方案,问题是我在WEB-INF文件夹下有JS,CSS和其他东西,这是外部无法访问的,当我将JS文件夹移动到更高级别时它开始工作

The new Location of static folder

静态文件夹的新位置

答案 1 :(得分:0)

你可以试试这个:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<script type="text/javascript"   src="<c:url value="/static/js/js/jquery-ui-1.10.3.custom.js"/>"></script>