JSF 简介(Technology Computer English)

Building user interfaces (UIs) with Java 2 Platform,
Enterprise Edition (J2EE) has never been completely satisfactory.
Today, most developers using JavaServer Pages (JSP) apply
HTML user controls, which represent the lowest common
denominator in what browsers can be Expected to support.
The result is that Web-based UIs have long been known as
being less rich than their fat client counterparts.
The JavaServer Faces technology consists of two separate
technologies. The first is a set of APIs for representing
user interface components and managing their state, handling
events and input validation, defining page navigation
across the user interface, and supporting internationalization
and accessibility. This part is visible to the end user. The
second, and more interesting technology from the perspective
of Web application developers, is a JSP custom tag
library for expressing a JSF interface within a JSP page.
This feature means that JSP developers can incorporate these
user interface controls simply by adding a tag library.
The JavaServer Faces technology also represents an
interesting user interface architecture. The key to JSF is
that the user interface code runs on the server, responding
to events that are generated on the client to make the user
interface itself distributed. While this characteristic represents
a reversal of traditional application design, a minute's
reflection can reveal several advantages in this architecture.
It works in the same way as your JSPs, for example,
providing for consistency of implementation. Assuming a
reliable and persistent network connection, there's no reason
why it can't be just as fast as any other user interface.
Applying JSF
In general, no additional configuration is required to
run applications using JSF. A set of examples provided as
WAR files is included in the reference implementation. You
need to make sure that your Servlet container is configured
to unpack WAR files, but otherwise all you have to do is
在J2EE 平台构建UI永远不令人满意。现今,大多数开
发人员使用JSP 来应用HTML用户控件——可以为不同浏览
器支持并显示。但是基于Web 的UI 早被认为远不如胖客户
机丰富。
JSF 包括两项独立技术。第一种是API 集, 它用于显示
用户界面组件并管理其状态,处理事件和输入校验,定义用
户界面间页面跳转,支持国际化和访问权限控制。这是用户
可见部分。Web应用程序的开发者会对于第二种技术更有兴
趣。这是一个JSP 用户自定义的标记库,用于在JSP 页面中
显示JSF 接口,这项功能意味着JSP 开发人员可以通过增加
标记库轻松合成用户界面控件。
JSF 技术也表现为一种有创新的用户界面的体系结构。
JSF 核心的是用户界面代码运行在服务器端,响应客户端生
成事件,使得用户界面自主布局。这项特性和传统的应用设
计很不一样,短暂思考一下,你就会发现这种体系结构的许
多优势。它的工作方式和JSP相似,例如提供执行的连续性。
如果有一个可靠和稳定的网络联接,它就没有比其他任何用
户界面慢的理由。
应用JSF
在通常情况下,不需要额外的配置就可以使用JSF,在
参考案例中包含了一些以 WAR 文档形式的范例。你要确
保Servlet容器配置得能解压WAR文件,否则你就只能从命
令行开始执行程序。WSDP 包使用ANT 作为开发工具,这
样你就可以在使用JSF 时借助ANT 自动创建应用。

 execute the application from a command line. The WSDP
kit uses Ant as its build tool, so you can use it to automate
the build processes of applications using JSF.
As you might imagine, when using JSF these pages
have no need to contain no Java code. Java code in this
example is restricted to the UserBean JavaBean. Any logic
that needs to be performed is done in model objects or
helper classes, typically encapsulated in JavaBeans, not in
the page.
The Good and Not So Good
There are a lot of good reasons to start using JSF in
your Web applications. Most important, they will make
your applications more user friendly. Your users will appreciate
the wider range of user actions made available by
these controls, and they will enable you to offer more
features more conveniently than you can with a standard
HTML front end.
At the same time, JSF offers significant advantages
from a programming standpoint. First, it requires little
more infrastructure than an ordinary JSP configuration
setup to use tag libraries, so there's little reason not to
use them. Second, if you already practice separating
presentation from logic, then this technology is something
you've been waiting for. It enables you to take the
next step of applying good software engineering principles
to your code by explicitly partitioning both your logic
and presentation, and individual logic components that
drive those user controls.
The primary problem with the JSF technology is that
it is new and must be configured behind the scenes. Because
JSF tags aren't a part of the standard set of HTML tags
that HTML writers use regularly, don't count on them
being able, or even inclined, to use them without some
encouragement. Programmers and Web application administrators
should make sure that the tag library is configured
properly for development use, and that page authors understand
its use and are trained in its features.
With an intriguing architecture and controls that go
beyond what you can achieve with simple HTML, the
JavaServer Faces technology offers hope for improving Web
applications. Users will appreciate better controls, while
developers will appreciate the improvements in the design
strategy and maintainability.
正如你所想,在使用JSF 时网页中无需再包含Java 代
码。Java 代码被限制在UserBean JavaBean。任何需要执行
的逻辑都在model 对象或者是helper类中完成,然后主要封
装在JavaBean 中,而不直接写在页面上。
利与弊
有很多充分理由让你在Web 应用中使用JSF,更重要的
是,它会使Web应用的用户界面更加友好。你的用户喜欢JSF
控件提供的更宽泛的行之有效的系列用户操作,它们将使你
可能提供比使用标准HTML 前端时更多更方便的功能。
同时,从编程的观点来看,JSF有明显优势。首先,它
只比JSP配置多出少许的基础组件就可使用标签库,所以没
有理由不使用它。其次,如果你已经尝试过把陈述从逻辑中
分离,这项技术正是你曾经期待的。通过明显隔离陈述和逻
辑,和驱动那些用户控件的独立逻辑组件,它可使你接下来
在代码编写中实践优秀的软件工程原则。
JSF 的主要障碍在于它是一种新技术,并必须在后台完
成配置。因为JSF标签不是HTML页面编辑平常使用的标准
HTML标签集的子集。如果没有相应改进,人们不会主动也
无意使用它们。程序员和Web应用的配置管理员必须确保标
签库在开发过程中的正确配置,页面编辑理解它的用法并接
受其性能的培训。
有了更具诱惑力的架构体系和控件,JSF 技术可以使你
完成更多单一HTML环境下的所不能,JSF 提供了改进Web
应用开发的希望。用户盼望更好的控件,而开发人员则盼望
在设计方案和维护方面的改进。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值