JSF 与 Facelets 与 JSP [英] JSF vs Facelets vs JSP

查看:26
本文介绍了JSF 与 Facelets 与 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:

  1. JSF 是 JSP 的替代品;和

  1. That JSF is a replacement for JSP; and

JSF 和 JSP 构成了 Java 网络层 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 是基于 MVC 模式的 Web UI 的标准化 Java 框架
  • JSP 是用于从模板生成网页的(更古老的)标准 - 这些可以用作 JSF 应用程序中的视图,但也可以与 JSF 分开使用.
  • Facelets 是一种基于纯 XML 模板(无 scriptlets)的替代视图技术,它是在 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 构成了 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 与 Facelets 与 JSP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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