Serving static content with Spring 3

前端 未结 3 1100
闹比i
闹比i 2021-02-20 07:11

I\'m trying to use resources mapping feature of Spring 3 and it does not seem to be working. Here is what I have:


    aaa<         


        
相关标签:
3条回答
  • 2021-02-20 07:49

    Got it fixed!

    Looks like there is a bug in ResourceHttpRequestHandler which only appears with Weblogic.

    To fix the issue:

    Remove

    <resources mapping="/resources/**" location="/resources/"/>
    

    Add

    <default-servlet-handler/>
    

    I know some of you suggested using the default-servlet-handler but the resources mapping must be removed in order for it to work!

    0 讨论(0)
  • 2021-02-20 07:56

    Try replacing your <resources mapping="/resources/**" location="/resources/" />

    with

    <mvc:annotation-driven />
    <mvc:resources mapping="/resources/**" location="/resources/" />
    
    0 讨论(0)
  • 2021-02-20 08:05

    You are mapping your app to the root context, so you should probably include

    <mvc:default-servlet-handler/>
    

    in your mvc config. Have a look at 15.12.5 in the spring docs. I wasn't able to get mvc:resources to work without that setting when my dispatcher servlet was mapped to /. At least, that's what I seem to remember having to do when I configured this a couple of months ago in my project.

    0 讨论(0)
提交回复
热议问题