How do I determine spring-mvc different view resolvers based on different domains?
I have a Spring-MVC project which needs to have 2 views for example: views/xxx/... views/yyy/..., I wondering how to determine which view i gonna use based on the domains for example: xxxcom, yyycom.
I know how to make one InternalResourceViewResolver,
but no clues for the multiple views based on the do开发者_运维问答mains.
Depending on your specific problem, rather than using different views based upon the domain I would go with Spring's Theme resolver to use the same views then change different parts of that view based upon the domain.
You can then swap out different bits of styling and content based upon the domain being visited.
For more information on the Spring theme resolver:
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/mvc.html#mvc-themeresolver
After understanding the way to implement themes you would simply have to write a theme resolver that resolved the theme properties file based upon the domain the user has visited.
Of course if you need completely different views for the different domains you might need a slightly different solution.
精彩评论