从 JSP 迁移到 Freemarker
我正在开发一个 Spring 2.5 项目,其中四个不同的 Web 应用程序具有重复的 JSP(它们都是同一 Web 应用程序的派生)。我想引入 Freemarker,这样我就可以在所有 Web 应用程序中外部化和重用这些模板。然而,我想迭代地解决这个问题,因为这将是一个大项目,所以我需要 JSP 和 Freemarker 和谐相处一段时间。
我知道Spring允许链接多个ViewResolver,但是JSP的 InternalResourceViewResolver 和 Freemarker 的 FreeMarkerViewResolver 两者声明它们需要位于链中的最后。我已经尝试将它们链接起来并指定顺序优先级,但没有运气。
Freemarker 似乎在某种程度上支持 JSP,尽管我真的不知道如何在逐步迁移中使用它(http://freemarker.sourceforge.net/docs/pgui_misc_servlet.html)。
有人有什么想法吗?
I'm working on a Spring 2.5 project where four different webapps have duplicate JSPs (they were all derivations of the same webapp). I want to introduce Freemarker so I can externalize and reuse these templates across all the webapps. However, I want to approach this iteratively since it's going to be a big project, so I need JSP and Freemarker to live in harmony for awhile.
I know Spring allows chaining multiple ViewResolvers, but JSP's InternalResourceViewResolver and Freemarker's FreeMarkerViewResolver both state that they need to be last in the chain. I've tried to chain them anyways and specify an order priority, but no luck.
Freemarker seems to support JSPs to some degree, though I don't really see how I could use that in a gradual migration (http://freemarker.sourceforge.net/docs/pgui_misc_servlet.html).
Does anyone have any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
参考
NixMash 帖子:使用 Spring Boot 从 Velocity 迁移到 FreeMarker
Java 模板引擎回顾 - DZone Web 开发
References
NixMash Post: The Move from Velocity to FreeMarker with Spring Boot
A Review of Java Template Engines - DZone Web Dev