Apache Tiles alternatives

2019-04-19 14:02发布

I am writing a Spring MVC application and looking for a way to do layouts in views. The only option that i see is Apache Tiles, which i have used before and know how painful it is to maintain its configuration.

Are there any good alternatives? I looked at SiteMesh and Spring Surf both seem to be dormant.

5条回答
孤傲高冷的网名
2楼-- · 2019-04-19 14:37

I faced the same dilemma about a month ago. I have been a seasoned developer using apache tiles, and I wanted to try something different.

I did some research and found that Spring MVC has some integration with freemarker and sitemesh. I decided to give both a shot.

Tiles seems to have the most active community.

You can also try a pure velocity implementation.

To sum up, my project ended up reverting back to tiles. Tiles is a robust templating framework, and once you understand it's powers, I will find it hard to find a good replacement. Also, if you are already skilled in apache tiles, I find the benifits of switching frameworks (if any) do not justify the learning curve required to picking up sitemesh/freemarker

http://www.sitemesh.org/overview.html

http://freemarker.sourceforge.net/

查看更多
爷的心禁止访问
3楼-- · 2019-04-19 14:38

IMO SiteMesh and Tiles are both pretty good approaches, although newer Tiles releases add a lot of untapped power--it's more than a simple templating mechanism.

If you're finding maintenance an issue I'd consider wrapping it up in a thin layer of abstraction using either a DSL or light GUI, either can make a big difference.

查看更多
祖国的老花朵
4楼-- · 2019-04-19 14:40

Although I've no experience with it personally, here's another alternative: https://code.google.com/p/commentit/

查看更多
一纸荒年 Trace。
5楼-- · 2019-04-19 15:00

Tiles and Sitemesh are very different in what they are designed for.

  • Tiles is used as a part of your application designed to use tiles.
  • Sitemash is designed as a filter in front of one or several already existing applications. Where you want to change the output of the applications (for example (a very easy task) replace the logo or add an extra menu option).

On the other hand I do not see why have so much xml. You have to write one xml block for each page to define which layout it needs. (If you still configure a list of files containing the tiles configurations then have a look at `org.springframework.web.servlet.view.tiles2.TilesConfigurer".)

If you want to get rid even of these files, then, perhaps, you should think more of extending tiles than using an other framework.

查看更多
虎瘦雄心在
6楼-- · 2019-04-19 15:03

You could use phpj

Its easy to use, comes with examples. You may use it for view templates or generate your html content any way you want to.

查看更多
登录 后发表回答