zoukankan      html  css  js  c++  java
  • ssm使用velocity模板语言

    1、在pom.xml里添加velocity模板语言支持的依赖

    <!-- velocity模板语言支持包 -->
        <dependency>
          <groupId>org.apache.velocity</groupId>
          <artifactId>velocity</artifactId>
          <version>1.7</version>
        </dependency>
        <!-- velocity-tools -->
        <dependency>
          <groupId>org.apache.velocity</groupId>
          <artifactId>velocity-tools</artifactId>
          <version>2.0</version>
        </dependency>

    2、spring-mvc.xml中配置velocity

    <!--velocity配置-->
        <bean id="velocityConfigurer" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
            <property name="resourceLoaderPath" value="/WEB-INF/views"/>
            <property name="velocityProperties">
                <props>
                    <prop key="input.encoding">utf-8</prop>
                    <prop key="output.encoding">utf-8</prop>
                    <prop key="file.resource.loader.cache">false</prop>
                    <prop key="file.resource.loader.modificationCheckInterval">1</prop>
                    <prop key="velocimacro.library.autoreload">false</prop>
                </props>
            </property>
        </bean>
    
        <!--velocity模板语言-->
        <bean class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
            <property name="suffix" value=".vm"/>
            <property name="contentType" value="text/html;charset=utf-8"/>
            <property name="dateToolAttribute" value="date"/><!--日期函数名称-->
        </bean>
        

    3、新建页面 .vm 后缀的文件

  • 相关阅读:
    网络状态码含义——(比如204,304, 404, 504,502)
    Vue两个简易代替vuex的方法(eventBus,observable)
    单页面首屏加载慢解决方案
    前端监控和前端埋点
    ES5 和 ES6的继承
    mysql 隔离级别
    mysql 事务
    Seata
    Sentinel Dashboard 部署
    java 垃圾回器
  • 原文地址:https://www.cnblogs.com/QW-lzm/p/8008843.html
Copyright © 2011-2022 走看看