本文主要是介绍springMVC配置html和jsp视图,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
<!-- velocity视图解析器 --><bean id="velocityViewResolver" class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver"><!-- 每个页面都引用 --><property name="exposeRequestAttributes" value="true" /><!-- 页面类型 --><property name="contentType" value="text/html;charset=UTF-8" /><!-- 前缀 --><property name="prefix" value="" /><!-- 后缀 --><property name="suffix" value=".html" /><!-- 每个页面都引用 --><property name="layoutUrl" value="layout.html" /><!-- 当前项目域名(IP)加端口号,html页面引用${rc.contextPath}--><property name="requestContextAttribute" value="rc" /><!--第一个匹配的是freemarker的视图解析器,如果匹配不成功,则自动选择order=1的其他解析器--><property name="order" value="0" /></bean><bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"><property name="resourceLoaderPath"><value>WEB-INF/pages</value></property><property name="velocityProperties"><props><prop key="input.encoding">UTF-8</prop><prop key="output.encoding">UTF-8</prop><prop key="contentType">text/html;charset=UTF-8</prop></props></property></bean><!--jsp视图解析器 --><bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"><property name="prefix" value="/WEB-INF/" /><property name="suffix" value=".jsp" /><property name="viewClass" value="org.springframework.web.servlet.view.JstlView" /><property name="order" value="1" /></bean>
ps:在项目中配置时在做进一步优化
这篇关于springMVC配置html和jsp视图的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!