---
title: "freemaker中使用 jspTaglibs"
author: "slnddd"
date: "2017-03-02T10:29:00Z"
tags: []
categories: ["Web前端"]
slug: "freemaker-jsptaglibs"
draft: false
lastmod: "2017-03-02T10:29:00Z"
id: 2359808
url: "https://slnddd.iteye.com/blog/2359808"
---

freemaker中使用jspTaglibs ： http://freemarker.org/docs/pgui\_misc\_servlet.html

 

&lt;#assign spring=JspTaglibs\["http://www.springframework.org/tags"]&gt;

 

&lt;@spring.message code="${code}" /&gt;

 

 

如上所示，在freemaker中使用jspTaglibs可以指定一个Url就可以访问定义好的tld文件了。

起初我不知道http://www.springframework.org/tags这个对应的是哪个tld文件，后来在网上查找到

 

The form tag library comes bundled in `spring-webmvc.jar`. The library descriptor is called `spring-form.tld`.

To use the tags from this library, add the following directive to the top of your JSP page:

```
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
```

where `form` is the tag name prefix you want to use for the tags from this library.

 

然后就去spring-webmvc.jar的META-INF下找到了spring.tld,这才明白调用的是这个

 

&lt;description&gt;Spring Framework JSP Tag Library&lt;/description&gt;

&lt;tlib-version&gt;3.0&lt;/tlib-version&gt;

&lt;short-name&gt;spring&lt;/short-name&gt;

 

&lt;uri&gt;http://www.springframework.org/tags&lt;/uri&gt;