Làm cách nào tôi có thể nhập macro spring.ftl vào trang mẫu Freemarker bằng cách sử dụng Spring MVC, Sitemesh và Freemarker?Nhập spring.ftl bằng Spring MVC, Sitemesh, Freemarker
Tôi đã định cấu hình ứng dụng Spring MVC bằng Sitemesh và Freemarker dựa trên Ted Young's configuration example. Theo tham chiếu tích hợp Spring MVC/Freemarker, cần nhập macro spring.ftl để liên kết mô hình sao lưu với chế độ xem qua < @ spring.bind "command.name" />. Tuy nhiên, cách làm này:
<#import "/spring.ftl" as spring>
<@spring.bind "command.user"/>
Kết quả trong ngoại lệ này:
org.springframework.web.util.NestedServletException:
Request processing failed; nested exception is freemarker.
template.TemplateException: Error reading imported file spring.ftl
Others have experienced this issue, nhưng tôi chưa tìm ra giải pháp trong google đất. Tôi cũng đã cố gắng sử dụng this technique (nén spring.ftl, đặt nó trong META-INF/lib và thêm mã zip vào đường dẫn xây dựng), nhưng dường như nó không hoạt động.
Cảm ơn!
Thật sao? [Tài liệu về mùa xuân] (http://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/view.html) nói để sử dụng '<#import" /spring.ftl " như spring /> ' – Raedwald