Accessing resources in JSP page of Spring MVC app

前端 未结 5 1361
迷失自我
迷失自我 2020-12-16 05:31

I am fairly new to spring and I am having issues with accessing my resources in my Spring mvc app. I have tried Google and using stack overflow to find an answer (none of th

5条回答
  •  一向
    一向 (楼主)
    2020-12-16 05:53

    You should place all of your static web content such as images, css and javascript in a resources directory under the webcontent (root directory) directory.

    enter image description here

    Then in myServlet-servlet.xml specify the directory as a resources directory. This will tell the dispatcher not to process requests for static resources.

    
    
    

    In your jsp files you should then access these resources using a root relative url that relies upon the context path resolved by JSP EL.

    
    

提交回复
热议问题