解决html视图解析器,html乱码
发布时间:09/01 来源:未知 浏览:
关键词:
项目编码,html页面编码阅读器解析编码都应当一致
html页面可以增加:<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
html视图解析器:
<bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"> <property name="exposeRequestAttributes" value="true" /> <property name="exposeSessionAttributes" value="true" /> <property name="viewClass"> <value>org.springframework.web.servlet.view.freemarker.FreeMarkerView </value> </property> <property name="cache"> <value>true</value> </property> <property name="suffix"> <value>.html</value> </property> <property name="contentType"> <value>text/html; charset=UTF-8</value> </property> </bean> <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> <property name="templateLoaderPath"> <value>/WEB-INF/views/</value> </property> <property name="freemarkerSettings"> <props> <prop key="locale">zh_CN</prop> <prop key="defaultEncoding">UTF-8</prop> <!-- <prop key="date_format">yyyy-MM-dd</prop> --> <!-- <prop key="time_format">HH:mm:ss</prop> --> <!-- <prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop> --> <!-- <prop key="number_format">0.################</prop> --> </props> </property> </bean>
相关引荐:
动态生成HTML元素并为元素追加属性
以上就是解决html视图解析器,html乱码的具体内容,更多请关注百分百源码网其它相关文章!