JSP和Facelets有什么区别? [英] What are the differences between JSP and Facelets?

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

问题描述

我刚开始阅读 Java EE 6教程,我有点困惑!我知道JavaServer Pages(JSP),甚至在我的本科学习期间做了一些编码。但是现在,在本教程中,我没有看到任何关于JSP的内容。

I just started reading the Java EE 6 Tutorial, and I'm a little confused! I knew about JavaServer Pages (JSP), and even did some coding during my undergraduate studies. But now, in this tutorial, I don't see anything about JSP.

相反,我读到了Facelets,一个新的视图定义框架(正如本教程中所描述的)。我在互联网上搜索了一下,以澄清JSP和Facelets之间的区别,我遇到了这篇文章给了我很多帮助(特别是 BalusC的回答)。但这些术语对我来说仍然有点不清楚。

Instead I read about Facelets, a new View Definition Framework (as it is described in this tutorial). I searched a little bit over the Internet to clarify the distinction between JSP and Facelets, and I came across with this post that helped me a lot (especially BalusC's answer). But these terms are still a little unclear to me.

JSP和Facelets有什么区别? Facelets是否会取代JSP,或者它只是一种适用于JSF的技术(如果它是后者,为什么)?如果它们不同,我应该何时使用它们?

What is the difference between JSP and Facelets? Are Facelets going to replace JSP, or is it just a technology that works better with JSF (and if it's the latter, why)? If they are different, when should I use each one of them?

推荐答案

正如您可以从教程中读到的那样,

As you can read from the tutorial,


术语Facelets用于表示
JavaServerTM Faces视图定义
Framework,这是一个页面声明
使用JavaServer Faces技术开发的使用
的语言。作为
的JavaServer Faces 2.0,Facelets是JavaServer Faces规范

部分,也是用于构建JavaServer
基于Faces的应用程序的首选演示
技术。

The term Facelets is used to refer to the JavaServerTM Faces View Definition Framework, which is a page declaration language that was developed for use with JavaServer Faces technology. As of JavaServer Faces 2.0, Facelets is a part of JavaServer Faces specification and also the preferred presentation technology for building JavaServer Faces based applications.

现在,JSP是Web的标准视图技术。但是,当采用JSF作为Web框架时,JSP不支持JSF 2.0中提供的所有功能。因此,需要一些标准视图技术来使用JSF 2.0。所以,Facelets就是这样。

Now, JSP is the standard view technology for the web. But when it comes to adopt JSF as a web framework, JSP doesn't support all the features provided in JSF 2.0. Therefore, there was a need of some standard view technology to work with JSF 2.0. So, Facelets is just that.

如果你根本不使用JSF,你不需要使用Facelets。在这种情况下,您可以使用JSP。或者很少有其他模板框架,如FreeMarker和Velocity。而且,一些Web框架定义了自己的标记,就像Struts2一样。因此,如果您决定使用Struts,那么使用Struts标记就可以了。

If you are not working with JSF at all, you don't need to employ Facelets. You can go with JSP in that case. Or there are few other template frameworks, like FreeMarker, and Velocity. Moreover, some web frameworks, defines there own mark-up, like Struts2. So if you decided to go with Struts, using Struts mark-up is the way to go.

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

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