0
動作しない私は、ディレクトリウェブ/ WEB-INF /ビュー/レイアウトSpringフレームワークFreemarkerのマクロレイアウト、ネストされたが、私は自分のWebアプリケーションと のための春のフレームワークを使用
<#macro layout>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
Some content here
<#nested>
Some content here
</body>
</html></#macro>
の主なレイアウトapplication.ftlを持っています
ディレクトリウェブ/ WEB-INF /ビュー内の別のページ、例えばpage1.ftlについては
<@layout>This is the page one</@layout>
とページ2 FTLを持っています。
<@layout>This is the page two</@layout>
しかし、動作しません。私のディスパッチャServlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<import resource="spring/spring-aop.xml" />
<context:component-scan base-package="com.birthright.controllers"/>
<context:annotation-config/>
<mvc:annotation-driven/>
<mvc:resources mapping="/resources/**" location="WEB-INF/resources/"/>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"
p:cache="true"
p:prefix=""
p:suffix=".ftl"
p:contentType="text/html; charset=UTF-8"/>
<bean id="freemarkerConfig"
class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"
p:templateLoaderPath="/WEB-INF/views/"
p:defaultEncoding="UTF-8">
<property name="templateLoaderPaths">
<list>
<value>/WEB-INF/views/layout</value>
</list>
</property>
<property name="freemarkerSettings">
<props>
<prop key="datetime_format">dd-MM-yyyy HH:mm:ss</prop>
<prop key="number_format">0.######</prop>
<prop key="url_escaping_charset">UTF-8</prop>
</props>
</property>
</bean>
</beans>