Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript cannot be found to be loaded from the JSP/controller path
    text
    copied!<p>When I try to load a js file externally I keep getting a 404 error in the firebug NET console. The JSP can't seem to be detecting the js file and I have tried many combinations with no luck, also searched the net without any real progress, can anyone point out what I am doing wrong here?</p> <p>Web XML</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt; &lt;display-name&gt;GreenwhichProject&lt;/display-name&gt; &lt;servlet&gt; &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;dispatcher&lt;/servlet-name&gt; &lt;url-pattern&gt;*.htm&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;welcome-file-list&gt; &lt;welcome-file&gt;redirect.jsp&lt;/welcome-file&gt; &lt;/welcome-file-list&gt; &lt;/web-app&gt; </code></pre> <p>Workspace Path Directory Structure Picture</p> <p><a href="http://img26.imageshack.us/i/workspacepath.jpg/" rel="nofollow">http://img26.imageshack.us/i/workspacepath.jpg/</a></p> <pre><code>PROJECT | WebContent | js |_jquery-1.5.js WEB-INF |_dispatcher-servlet.xml |_web.xml jsp |_OrderTaxi.jsp </code></pre> <p>Additionally this is how a normal controller function looks like</p> <pre><code>@RequestMapping(value="/taxiOrder/loadOrderTaxiServicePage.htm", method = RequestMethod.GET) public String showOrderTaxiServicePage(ModelMap model){ return "orderTaxi"; } </code></pre> <p>So when I have to access a page it will usually be the /"controllerName"/"functionHtmName"</p> <p>dispatcher-servlet.xml has a view resolver if it will be useful for figuring out the problem</p> <pre><code>&lt;bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/jsp/" p:suffix=".jsp" /&gt; </code></pre> <p>Additionally this is how I am looking for the JS in my JSP file</p> <pre><code>&lt;script type="text/javascript" src="/js/jquery-1.5.js"&gt;&lt;/script&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload