<!-- 视图解析器1:html视图解析器 必须先配置freemarkerConfig,注意html是没有prefix前缀属性的 --> <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> <property name="freemarkerSettings"> <bean class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="properties"> <props> <prop key="default_encoding">utf-8</prop> <prop key="output_encoding">utf-8</prop> </props> </property> </bean> </property> <property name="templateLoaderPath"> <value>/webpage/</value> </property> </bean> <bean id="htmlviewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver" p:suffix=".html" p:order="0"> <property name="contentType" value="text/html;charset=UTF-8"/> </bean> <!-- 视图解析器2:jsp视图解析器 --> <bean id="jspviewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/webpage/" p:suffix=".jsp" p:order="1"> <property name="contentType" value="text/html;charset=UTF-8"/> </bean>
<freemarker.version>2.3.23</freemarker.version>