Skip to content Skip to sidebar Skip to footer

Unable To Load Java Script Files In Jetty Webapplication

I have a very simple webapp where I am trying to plot graphs using flot javascript library. My JSP file goes this way where I am importing the required *.js files as follows. Rela

Solution 1:

You have a bad servlet-mapping setup.

The servlet named mvc-dispatcher is setup at url-pattern of "/", also known as the servlet spec default servlet path spec. Something that the web container itself provides to allow it to serve static content (like css and javascript files).

With your mvc-dispatcher at "/" that means the Default Servlet itself cannot serve static content.

That also means that org.springframework.web.servlet.DispatcherServlet is now responsible for serving all content from the WebApp. This is an atypical servlet-mapping and I doubt that's the role of the spring DispatcherServlet.

Consider using a suffix based servlet path spec like "*.html" or a prefix based servlet path spec like "/*" (this is outlined in the Section 12 of the Servlet Spec)

Post a Comment for "Unable To Load Java Script Files In Jetty Webapplication"