Multiple View resolvers in spring mvc

一世执手 提交于 2019-11-29 02:11:59

You can add as many view resolvers as you want. You can specify the order in which the view resolvers need to be checked. Spring will take the first view resolver which can successfully resolve the view.

ex: Since you have JSP and freemarker add the view resolvers for both and give the order property 1 for JSP and 2 for freemarker. If your view is /freemarker/hello.ftl then the JSP resoplver will fails since it will not be able to find th file /freemarker/hello.ftl, then the freemarker resolver will handle this view. But if the JSP resolver is able to find the file and resolve it then freemaker resolver will not be used to resolve that view

Refer: Chaining ViewResolvers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!