Announcement Announcement Module
No announcement yet.
Problem serving JS resources Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem serving JS resources

    Hello everyone,

    I'm trying to use Spring JS and Spring Faces in my project, but the resources never get loaded, I get a 404 error when looking up the .js and .css files.

    My dispatcher servlet is mapped to /spring/* like the following in my web.xml:

    And, since I'm using Spring 3.1, I'm configuring the resources to be loaded like the documentation suggests:

    <mvc:resources mapping="/resources/**" location="/, classpath:/META-INF/web-resources/" />
    According to the docs, the full URL for the resources in my app should be along the lines of: /myapp/spring/resources/spring/Spring.js since my dispatcher servlet is mapped to /spring/*. However, I have not been able to configure the resources to point to that URL, no matter what I change in the mvc:resources location attribute, I always get a URL like: /myapp/resources/spring/Spring.js and the resources are not found (404 error).

    Is there something I am missing? Thank you in advance...

  • #2
    And why should the mvc:resources tag influence how the urls are created?! How are you creating the urls in your JSP.


    • #3
      I thought the same, because I'm using another mvc:resources that points to a disk location, and that is working fine... And when I hardtype the JS resources URL they are correctly found...

      Right now I'm using JSF (Facelets), and when I include the Spring Faces namespace the resources point to /myapp/resources/spring/Spring.js instead of going through the dispatcher servlet...

      As I said before, if I load them on my own pointing to the right address, they load fine, however the requests that try to load the resources automatically still fail and the browser keeps giving that error...