Announcement Announcement Module
No announcement yet.
JavaScript will only load if located in /static Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • JavaScript will only load if located in /static


    I'm coming across a problem when using Spring Security with JavaScript or CSS files.

    I have a project I am building with Maven and have the following structure:


    I use the standard login from spring security and that works fine. The problem occurs when index.jsp loads and pulls in a JS file from the /jsapp folder. The file appears to have the content of the index.jsp instead of it's actual content.

    Now, if I move the /jsapp to sit under /static, it works perfectly!

    Is there a requirement for all JS files (and similar) to sit under the /static folder? If so, is there a way around this? Can I store JS files in a folder which is not the /static one?


  • #2
    you can place js/css to any folder, just make sure that its filter="none" is there.


    • #3
      Hi Rohan, thanks for the response. Setting filters to none is essentially the same as setting security to none in the <http> tag.

      I'd like to maintain the files in jsapp with security.

      To maintain security, the folder needs to be under static or it won't server the JS correctly.

      On a side note, filters is deprecated with version 3.1


      • #4
        Found out how to fix this issue. I added the following to the web.xml: