JSF vs Facelets与JSP [英] JSF vs Facelets vs JSP
问题描述
对于Java Server Faces 与所谓的 facelets 之间的具体区别,我似乎无法得到明确的答案。任何人都可以给我一个明确的答案吗?!?
I can't seem to get a clear answer as to the concrete difference between Java Server Faces vs. so-called facelets. Can anyone give me a clear-as-day answer?!?
另外,我知道JSF或JSP可用于创建动态网页,但两个看似 - 冲突的细节令我困惑。我听说过以下两种情况:
Also, I understand that either JSF or JSP can be used to create dynamic web pages, but two seemingly-conflicting details are confusing me. I've heard both of the following:
-
JSF是JSP的替代品;和
That JSF is a replacement for JSP; and
JSF和JSP构成了Java的Web层MVC范例中 View 的不同部分
JSF and JSP form different parts of the View in Java's web-tier MVC paradigm
那是哪个?逻辑规定它几乎肯定不能同时存在!
So which is it? Logic dictates it almost certainly can't be both!
推荐答案
- JSF是一个标准化的Java框架基于MVC模式的Web UI
- JSP是用于从模板生成网页的(更旧)标准 - 这些可以用作JSF中的视图应用程序,但也与JSF分开。
- Facelets是基于纯XML模板(无scriptlet)的替代视图技术,它是在JSF标准的第2版中引入的。它们只能在JSF应用程序中使用。
- JSF is a standardized Java framework for web UIs based on an MVC pattern
- JSPs are a (much older) standard for generating web pages from templates - these can be used as the View in a JSF application, but also separately from JSF.
- Facelets are an alternative view technology based on pure XML templates (no scriptlets) which was introduced with Version 2 of the JSF standard. They can only be used in a JSF application.
鉴于此,让我们来看看你的冲突声明:
In the light of that, let's take a look at your conflicting statements:
JSF是JSP的替代品;和
That JSF is a replacement for JSP; and
不完全正确,因为JSF可以在其视图中使用JSP(并且必须在JSF 2之前)。但是,使用Facelets的JSF应用程序可以被视为基于JSP的技术的替代品。
Not quite true, since JSF can use JSPs for its view (and had to, prior to JSF 2). However, JSF apps using Facelets can be seen as a replacement for JSP-based technologies.
JSF和JSP构成View的不同部分Java的Web层MVC范例
JSF and JSP form different parts of the View in Java's web-tier MVC paradigm
完全错误 - JSF涵盖整个MVC模式(尽管它可以与EJB重叠,因为它们都基于关于可以在同一类中混合的注释。)
Completely wrong - JSF covers the entire MVC pattern (though it can overlap with EJBs, since both are based on annotations that can be mixed in the same class).
这篇关于JSF vs Facelets与JSP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!