<!-- 视图解析器 -->
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
</bean>
<!--html视图解析器 必须先配置freemarkerConfig,注意html是没有prefix前缀属性的-->
<bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
<property name="templateLoaderPath">
<value>/dist/</value>
</property>
<!--解决html转发 中文乱码问题-->
<property name="freemarkerSettings">
<props>
<prop key="locale">zh_CN</prop>
<prop key="defaultEncoding">UTF-8</prop>
</props>
</property>
</bean>
<bean id="htmlviewResolver"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="suffix" value=".html"/>
<property name="order" value="0"></property>
<property name="contentType" value="text/html;charset=UTF-8"></property>
</bean>
<bean class="edu.sjtu.nicman.web.controller.config.SwaggerConfig"></bean>
<!-- 静态资源映射 -->
<mvc:resources mapping="/dist/**" location="/" cache-period="31536000"/>
jsp解析器 html解析器
最新推荐文章于 2024-07-03 20:27:38 发布