Skip to content

Instantly share code, notes, and snippets.

@wataru420
Created July 16, 2012 14:09
Show Gist options
  • Save wataru420/3122922 to your computer and use it in GitHub Desktop.
Save wataru420/3122922 to your computer and use it in GitHub Desktop.
SpringFreemarkerMacro
<#import "/spring.ftl" as spring />
<a href="<@spring.url '/userUrl'/>">ユーザ</a>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<spring:url value="user" var="userUrl" />
<a href="${fn:escapeXml(userUrl)}">ユーザ</a>
<bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
<property name="cache" value="true"/>
<property name="prefix" value=""/>
<property name="suffix" value=".ftl"/>
<!-- この行を追加してtrueにしておくとSpringFreemarkerMacroが有効になります。 -->
<property name="exposeSpringMacroHelpers" value="true"/>
</bean>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment