ASP.NET Master Pages等效于Java [英] ASP.NET Master Pages equivalent in Java

查看:144
本文介绍了ASP.NET Master Pages等效于Java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Java Web开发世界中的Master Pages是什么?我听说过Tiles,Tapestry和Velocity,但对它们一无所知。它们和母版页一样易于使用吗?

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 easy to use as Master Pages?

我想要像设置一个模板一样简单,后续页面从模板派生并覆盖内容区域,类似于母版页。

I want something as easy as set up one template and subsequent pages derive from the template and override content regions, similar to Master Pages.

任何例子都会很棒!!

Any examples would be great!!

推荐答案

首先,Java中的ASP.Net相当于将成为一个Web框架,例如您提到的(Tiles,Tapestry和Velocity)。

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.

主页是ASP.Net(.Net Web框架)的一个特性,因此您正在寻找类似于Java中的母版页的功能网络框架。

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 提供了一些使用Tiles和JSP实现类似于Struts(Java Web框架)的基本示例。在这种情况下,Master Pages功能是Struts之上的一个插件。

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是一个通用的模板引擎,不专门用于网页,绝对比你需要的更复杂。 (我已经看到它用于代码生成。)

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更像是一个功能齐全的Web堆栈而不是Tile,可能对您的目的有好处。它的模板功能包括创建一个组件并将所有常见标记放入其中。一个例子是 http://www.infoq.com/articles/tapestry5-intro

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.

具体情况因您选择的Java Web框架而异。

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

这篇关于ASP.NET Master Pages等效于Java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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