StringTemplate和FreeMarker之间的主要区别是什么? [英] What are the main differences between StringTemplate and FreeMarker?

查看:164
本文介绍了StringTemplate和FreeMarker之间的主要区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网络似乎充满了Velocity和FreeMarker之间的比较,并且它们似乎相当合理.但是,StringTemplate和FreeMarker之间似乎几乎没有比较!

The net seems to be full of comparisons between Velocity and FreeMarker, and they seem to be reasonably equivalent. But there seems to be almost no comparisons between StringTemplate and FreeMarker!

那么,StringTemplate和FreeMarker之间的主要区别是什么?

So, what are the main differences between StringTemplate and FreeMarker?

我对它们的用法是仅生成HTML页面.在这两种方法中,我希望FreeMarker更加合适,功能更强大,因为这似乎是更常见的一种-但快速浏览一下,似乎StringTemplate实际上具有更合适的功能!

My usage for them would be to generate HTML pages only. Out of the two, I would've expected FreeMarker to be the more suitable and more capable, as that seems to the more common one - but through a quick glance it seems that StringTemplate actually has more suitable features!

如果同时使用两者的人有时间发表评论,那就太好了-对于实际的细节,我可以并排阅读文档,但是我希望有一些入门的知识.

It would be great if someone who has used both would have time to comment - for the actual specifics, I can just read the documentation side by side, but I'd like something to get started with.

推荐答案

在厌倦了JSP的模板中的代码"模型之后,我设计了ST来构建jGuru.速度和朋友(即我认为的每一个其他引擎)为您提供的动力超出了您的需要.我基本上使用了四个功能来构建jGuru.com(如 paper ).不需要更多功能,这会使您将模型纠缠到模板中.如果您要构建一个一次性的原型,那没关系,任何引擎都可以.在这种情况下,模板中的代码是可以的,因为您无需关心维护.

I designed ST to build jGuru after getting sick of the "code in template" model of JSP. Velocity and friends (i.e., every other engine i think) give you more power than you need. I used basically four features to build jGuru.com (as described in paper). More features are unnecessary and lead you to entangle your model into the template. If you're building a one-off prototype, that's ok and any engine is fine. Code in templates is ok in that case since you don't care about maintenance.

人们似乎忽略了另一件事:图形设计师怎么会读模板中的代码?他们不能.那么,它们如何在模板上工作呢?即使更改某些元素的顺序也会破坏您的模型.除非您想要一个看起来像编码器的网站来构建html,否则您确实需要在商业环境中进行分离;

Another thing people seem to ignore: how the hell can a graphics designer read code in templates? They can't. So, how can they work on the templates then? Even changing the order of some elements can break your model. You really need the separation to work in commercial environment, unless you want a site that looks like a coder built the html ;)

这篇关于StringTemplate和FreeMarker之间的主要区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆