Spring MVC; avoiding file extension in url?

前端 未结 6 1639
臣服心动
臣服心动 2020-12-31 20:46

I just started with Spring Web MVC. I\'m trying to avoid file extenstions in the url. How can i do this? (I\'m using Spring 2.5.x)

Bean:

<         


        
6条回答
  •  温柔的废话
    2020-12-31 21:14

    As far as I know you can't do this if you're using JSP's as your view for controllers.

    Because when you pass a model to a JSP, Spring MVC internally performs a 'forward' to the URL of the JSP. If you use /* then this forward will also be handled by your DispatcherServlet and not by your JSP view.

    What you can do is use /something and have your JSP's in a different directory

提交回复
热议问题