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 后缀的文件

  • 相关阅读:
    用变量构造函数检查变量类型
    HTML5的File API读取文件信息
    jQuery插件中的this指的是什么
    了解babel
    了解.gitignore
    高德地图画正六边形
    编写可维护性的js读书笔记
    百度地图遇到的问题
    实用的两个移动端demo
    git基本操作总结
  • 原文地址:https://www.cnblogs.com/juihai/p/10307780.html
Copyright © 2011-2022 走看看