开发者

An HTML template engine for Java like Genshi or Zope's TAL

I need to work with a Web Designer so...

Can you suggest me any?

Thanks in advance

FYI:

Zope's TAL

The Template Attribute Language (TAL) is a templating language used to generate dynamic HTML and XML pages. Its main goal is to simplify the collaboration between programmers and designers. This is achieved by embedding TAL statements inside valid HTML(or XML, respectively) tags which can then be worked on using common design tools.

Genshi

Genshi is a Python library that provides an integrated set of components for parsing, generating, and processing HTML, XML or other textual content for output generation on the web.

The main feature is a template language that is smart about markup: unlike conventional template languages that only deal with bytes and (if you're lucky) characters, Genshi knows the difference between tags, attributes, and actual text nodes, and uses that knowledge to your advantage.

NOTE: The key feature here is:

This is achieved by embedding TAL (or Genshi) statements inside valid HTML(or XML, respectively) tags which can then be worked on using common design tools

Example: Genshi:

<div>
  <b py:if="foo"&g开发者_StackOverflow社区t;${bar}</b>
</div>

TAL:

<h1 tal:content="string:Some altogether different headline">
The headline visible to the designer
</h1>


You can also check Apache Tapestry. It is more of a web framework than a HTML templating engine but has similar functionality that you need.


Checkout FreeMarker or Apache Velocity.

FreeMarker is more advanced but a little complex as compared to Apache Velocity.


Just adding another framework similar to Tapestry... wicket, which has the feature that I asked for, too.

For a comparison between Tapestry and Wicket see this article.


I just found out about Thymeleaf (http://thymeleaf.org). Quoting DuyHai's Java Blog article Spring MVC part III: ThymeLeaf integration:

Unlike many Java templating engines of its kind, Thymeleaf is a full HTML engine, meaning that the template file itself is a HTML file that can be rendered by any Web browser.

As fas as I know, the only other attribute-based template engine out there is TAL (Template Attribute Language) using Python language.

The fact that the template itself can be displayed in a web browser is an important feature. Indeed while developing an Web page, people first start designing the static part of the GUI (css, color, layout) before focusing on the dynamic part (data injection, conditional rendering)…With Thymeleaf…we do not need to add any new tag, just new attributes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜