spring中freemarker自定义标签详解

最近因工作需要,从网上搜了一个jeecms网站,准备进行借鉴使用,发现里面对模板用的不错,前面虽说也对freemarker有用,但是还没有这么深入,所以就查了一些资料,下面进行总结下。

一、jar包准备

首先是Spring、SpringMVC的依赖jar包……

然后是Freemarker的依赖jar包,我使用的是freemarker-2.3.20.jar,如果使用maven的话可以直接在pom.xml中添加一段把它引进来:

[html]  view plain copy
  1. <groupId>org.freemarker</groupId>  
  2. <artifactId>freemarker</artifactId>  
  3.  <version>2.3.20</version>  


二、配置web.xml

[html]  view plain copy
  1. <?xml version="1.0" ?>  
  2. <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  3.     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"  
  4.     version="3.0">  
  5.     <!--  Spring 服务层的配置文件 -->  
  6.     <context-param>  
  7.         <param-name>contextConfigLocation</param-name>  
  8.         <param-value>classpath:applicationContext.xml</param-value>  
  9.     </context-param>  
  10.       
  11.     <!--  Spring 容器启动监听器 -->  
  12.     <listener>  
  13.         <listener-class>org.springframework.web.context.ContextLoaderListener  
  14.         </listener-class>  
  15.     </listener>  
  16.   
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值