---
title: "SpringMVC freemarker标签Struts2化"
author: "simen_net"
date: "2010-03-29T09:34:33Z"
tags: []
categories: ["企业架构"]
slug: "springmvc-freemarker-struts2"
draft: false
lastmod: "2010-03-29T09:34:33Z"
id: 626879
url: "https://simen-net.iteye.com/blog/626879"
---

看起来标题名字怪怪的啊^\_^

以前一直使用Struts2+freemarker，在里面使用${base} ${getText("\*\*\*")}感觉挺舒服的，现在尝试SpringMVC必须要用

```
<@spring.url "/***.html"/>
<@spring.messageText "***" />
```

 也不复杂，但以前写的很多ftl就要修改，不爽中\`\`\`\`，仔细再想想也简单 嘿嘿，增加一个ftl

spring-include.ftl

```
<#assign base=springMacroRequestContext.getContextUrl("")>
<#assign getText=springMacroRequestContext.getMessage>
```

 在要用的ftl文件里面

```
<#include "/sxt/view/spring-include.ftl" >
<a href=${base}/***.html>dddd</a>
${getText("******")}
```

 完活，俺的ftl基本不用改就能用了 哈哈