ASP.NET Master Pages equivalent in Java

前端 未结 3 1960
星月不相逢
星月不相逢 2021-01-02 20:19

What would be the Master Pages equivalent in the Java web development world? I\'ve heard of Tiles, Tapestry and Velocity but don\'t know anything about them. Are they as e

3条回答
  •  温柔的废话
    2021-01-02 20:46

    First, the equivalent of ASP.Net in Java is going to be a web framework, such as the ones you mention (Tiles, Tapestry and Velocity).

    Master pages give the ability to define pages in terms of content slotted into a master template.

    Master pages are a feature of ASP.Net (the .Net web framework), so you are looking for a feature similar to master pages in a Java web framework.

    http://tiles.apache.org/framework/tutorial/basic/pages.html gives some basic examples using Tiles and JSP to implement something similar with Struts, a Java web framework. In this case, the Master Pages functionality is a plugin on top of Struts.

    Velocity is a generic templating engine, not specialized for web pages and definitely more complicated than you need. (I've seen it used for code generation.)

    Tapestry is more of a full featured web stack than Tile, and is probably good for your purposes. Its templating functionality involves creating a component and putting all common markup in that. An example is at http://www.infoq.com/articles/tapestry5-intro.

    The specifics of this differ based on which Java web framework you choose.

提交回复
热议问题