You can configure InternalResourceViewResolver something like this:
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/pages/"/> <property name="suffix" value=""/> </bean>
Where the WEB-INF/pages folder can contain both jsp and html pages, and the suffix property remains empty.
Then in your controller, you can have methods that return html views, and methods that return a suffix based on jsp views. For example, if index.html and index.jsp both exist in WEB-INF/pages , you can do the following:
@RequestMapping("/htmlView") public String renderHtmlView() { return "index.html"; } @RequestMapping("/jspView") public String renderJspView() { return "index.jsp"; }
However, since html pages are static and do not require processing, it is better to use the <mvc:resources> rather than a view converter for this type of page. See the docs for more information.
Will keeling
source share