• SSM中JSP和thymeleaf同时使用


    在Spring—Mvc的xml文件中添加:

    <!--    thymeleaf模板-->
        <bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
            <property name="prefix" value="/"/>
            <property name="suffix" value=".html"/>
            <property name="templateMode" value="HTML5" />
            <property name="cacheable" value="false" />
            <property name="characterEncoding" value="UTF-8"/>
        </bean>
        <!--thymeleaf4-->
        <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
            <property name="templateResolver" ref="templateResolver" />
        </bean>
    
        <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
            <property name="viewResolvers">
                <list>
                    <!--jsp-->
                    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
                        <property name="viewNames" value="behind/*"/>
                        <property name="prefix" value="/"/>
                        <property name="suffix" value=".jsp"/>
                    </bean>
                    <!--thymeleaf-->
                    <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
                        <property name="viewNames" value="html/*"/>
                        <property name="characterEncoding" value="UTF-8"/>
                        <property name="templateEngine" ref="templateEngine" />
                        <property name="order" value="2" />
                    </bean>
                </list>
            </property>
        </bean>
  • 相关阅读:
    洛谷 P1555 尴尬的数字
    洛谷 P1318 积水面积
    9.8解题报告
    洛谷 P1464 Function
    洛谷 P1122 最大子树和
    cogs 66. [HAOI2004模拟] 数列问题
    49. 跳马问题
    洛谷 P3137 [USACO16FEB]圆形谷仓Circular Barn_Silver
    codevs 3164 质因数分解
    codeforces 482C Game with Strings
  • 原文地址:https://www.cnblogs.com/NotPig/p/13085042.html
Copyright © 2020-2023  润新知