Home >Web Front-end >HTML Tutorial >Solve the problem of html view parser and garbled html code

Solve the problem of html view parser and garbled html code

不言
不言Original
2018-04-27 14:05:591874browse

The content of this article is to solve the problem of html view parser, html garbled code, which has certain reference value. Now I share it with everyone. Friends in need can refer to

project coding, html page coding browsing The parser parsing encoding should be consistent

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

    <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>

Related recommendations:

Dynamic Generate HTML elements and append attributes to the elements

                           

The above is the detailed content of Solve the problem of html view parser and garbled html code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:An introduction to HTMLNext article:An introduction to HTML