JSF in action笔记--术语(jsf pie)--2008.04.07

  1. UI component :应该说类似于一个html中的标签,不过不是像html,wml这样的最终展示页面,而是给开发员们用的,就像是一个模板,真正放到服务器上的时候,要由Render 来解释成html 或wml等页面.这些组件是在服务器端的.
  2. Render : 就是用来解释UI component组件的,针对不同的语言,可以解释成html,wml等页面形式.就像"<h:inputText id="inputText" size="20" maxlength="30"/>" 经过解释以后在用户的浏览器中看到的是"<input id="myForm:inputText" type="text" name="myForm:inputText"
    maxlength="30" size="20" />"
  3. Validator : 用来验证用户输入的值是不是有效的.像这样"<h:inputText>
    <f:validateLength minimum="2" maximum="10"/>
    </h:inputText>"
  4. Backing Bean : 一个java类,包含有响应用户的事件的方法,及经过逻辑处理后的结果,是UI与Model之间的交互桥梁.
  5. Converter : 针对某个用户输入的值,转换成Backing bean中某个属性,例如用户输入的时间,要转换成java对象里的Date对象,以及 java对象里的值在页面上的展现格式.
  6. Events : 某件事情发生了,jsf有4个标准的事件类型,a.  value-change events,是指用户的输入框中的值发生了变化, b. action events, 当用户点击了某个按钮,进行提交或页面跳转的时候, c.  data model events  , d.   phase events 指jsf响应用户的阶段中产生的事件. 上面的这些事件类型是可以由用户来自行扩展的.
  7. Listeners : Backing Bean中用来响应特殊事件的方法,对于action event 有两种listener 一种是返回一个字符串,由JSF用来做跳转的,一种是不返回字符串,只是进行逻辑处理的."<h:commandButton type="submit" value="Login" action="success" immediate="true"/>"这段代码中的action="success"为静态输出,用来做导航(跳转),如果是这样action="#{loginForm.login}"为动态输出,输出的结果由login方法来判断,然后根据返回的字符串来做导航.(跳转),如果不想做跳转,则可以用actionListener这个属性,例如"<h:commandButton id="redisplayCommand" type="submit" value="Redisplay" actionListener="#{myForm.doIt}"/>",方法为public void doIt(ActionEvent event){...}
  8. Messages : Error可以分为两类,应用错误(通常由一个单独的页面展示错误)和用户输入错误(应该在用户当前输入页面展示),可以对特定的组件显示Message ,例如"<h:message id="errors" for="helloInput" style="color: red"/>"中的for属性,
  9. Navigation : The act of moving from one page to another is called navigation.(从一个页面到另一个页面称之为导航),具体的从那页面到那个页面由配置文件来设定.例如
    <navigation-rule>
    <from-view-id>/login.jsp</from-view-id>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/mainmenu.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
    <from-outcome>failure</from-outcome>
    <to-view-id>/login.jsp</to-view-id>
    </navigation-case>
    </navigation-rule>

 

Table 2.1 These terms are the key pieces of the JSF pie.

 Term

 Description

 UI component (also
called a control or simply
a component)
 A stateful object, maintained on the server, that provides specific functionality
for interacting with an end user. UI components are JavaBeans with properties,
methods, and events. They are organized into a view, which is a tree of
components usually displayed as a page.
 Renderer Responsible for displaying a UI component and translating a user’s input into
the component's value. Renderers can be designed to work with one or more
UI components, and a UI component can be associated with many different
renderers.
 Validator Responsible for ensuring that the value entered by a user is acceptable. One
or more validators can be associated with a single UI component.
 Backing beans Specialized JavaBeans that collect values from UI components and implement
event listener methods. They can also hold references to UI components.
 Converter Converts a component’s value to and from a string for display. A UI component
can be associated with a single converter.
 Events and listeners JSF uses the JavaBeans event/listener model (also used by Swing). UI components
(and other objects) generate events, and listeners can be registered to
handle those events.
 Messages Information that’s displayed back to the user. Just about any part of the application
(backing beans, validators, converters, and so on) can generate information
or error messages that can be displayed back to the user.
 Navigation The ability to move from one page to the next. JSF has a powerful navigation
system that’s integrated with specialized event listeners.

 

以下为JSF的UML图

Figure 2.1 A model of how the key JSF concepts relate to one another.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值