sitemesh and spring MVC decorator pattern problems

后端 未结 4 1328
借酒劲吻你
借酒劲吻你 2021-01-03 13:15

I have sitemesh with spring working, this is the configuration: decorator.xml




        
4条回答
  •  爱一瞬间的悲伤
    2021-01-03 13:47

    I've had that exact problem. What's happening is that any part of the url path you specify in the web.xml gets stripped out by the web server before it gets passed to Spring, but only if you put the wildcard at the end. You have already discovered that when your url is www.myapp.com/spring/cliente/index.html, if you put this in your web.xml

    
       Spring MVC Dispatcher Servlet
       /spring/*
    
    

    Spring will only see the part of the request path after the /spring. In that case you need to specify your RequestMapping as "/cliente/index.html".

    You can also specify your servlet mapping this way.

    
       Spring MVC Dispatcher Servlet
       *.html
    
    

    Then Spring will see the entire request path and you can specify your request mappings like this "/spring/cliente/index.html". The same goes for Sitemesh. It only sees what the web server passes through.

提交回复
热议问题