解决html视图解析器,html乱码


本文摘自PHP中文网,作者不言,侵删。

这篇文章介绍的内容是解决html视图解析器,html乱码,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下

项目编码,html页面编码浏览器解析编码都应该一致

1

html页面可以添加:<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

  1. html视图解析器:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

<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乱码的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

Html中的font是什么标签?怎么使用?(代码详解)

Html td怎么设置宽度

Html怎么设置倾斜

Html的行内元素有哪些

img在Html中是不是双标签元素

Html跳转代码是什么

Html怎么设置style样式

Html是一种什么语言

如何区分Html和xHtmlHtml和xHtml的区别在哪?

浅谈网页中提升svg文件可访问性的几种方法

更多相关阅读请进入《Html》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...