How to access static resources when mapping a global front controller servlet on /*

前端 未结 19 2156
轮回少年
轮回少年 2020-11-22 07:35

I\'ve mapped the Spring MVC dispatcher as a global front controller servlet on /*.

               


        
19条回答
  •  悲&欢浪女
    2020-11-22 08:21

    I found that using

    
    

    in the spring MVC servlet bean definition file works for me. It passes any request that isn't handled by a registered MVC controller on to the container's original default handler, which should serve it as static content. Just make sure you have no controller registered that handles everything, and it should work just fine. Not sure why @logixplayer suggests URL rewriting; you can achieve the effect he's looking for just adequately using Spring MVC alone.

提交回复
热议问题