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

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

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

               


        
19条回答
  •  故里飘歌
    2020-11-22 08:24

    The best way to handle this is using some kind of URL re-writing. In this way, you can have clean restful URLs, and NOT with any extensions i.e abc.com/welcom/register as opposed to abc.com/welcome/resister.html

    I use Tuckey URL which is pretty cool.

    It's got instructions on how to set up your web app.I have set it up with my Spring MVC web app. Of course, everything was fine until I wanted to use annotations for Spring 3 validations like @Email or @Null for domain objects.

    When I add the Spring mvc directives:

    < mvc:annotation-driven  /> 
    < mvc:default-servlet-handler />
    

    .. it breaks the good ol Tuckey code. Apparently, < mvc:default-servlet-handler /> replaces Tuckey, which I'm still trying to solve.

提交回复
热议问题