Spring mvc:映射路径规则

ato*_*nog 7 spring spring-mvc

我需要使用@RequestMapping(value ="/ client")为带注释的控制器中的所有方法映射拦截器

在映射中我有

<mvc:interceptor>
   <mvc:mapping path="/app/client/*"/>
   <bean class="com.cci.isa.web.CIPClientHandleInterceptor" />
</mvc:interceptor>
Run Code Online (Sandbox Code Playgroud)

这个拦截完美要求像URL:
1. HTTP://主机/应用程序/客户端/ clientUpdateForm的clientId = 305

但不要求像URL:
2 的http://主机/应用/客户/ clientUpdateForm/clientId_305(方法名称后用斜杠)

怎么称它为第二个变种?

非常感谢.

jel*_*ies 5

这个问题太老了,但这可能对某人有所帮助.

您应该尝试删除/app,我认为这不是必要的,也许这会导致问题.

<mvc:mapping path="/client/**"/>
Run Code Online (Sandbox Code Playgroud)


nic*_*ild 2

我认为这将实现你想要的:

<mvc:mapping path="/app/client/**/*"/>
Run Code Online (Sandbox Code Playgroud)

“/**”表示任意数量的目录。当它与“/*”结合使用时,您可以使用任意文件名查看任意文件夹深度。