`
lmbb1945
  • 浏览: 12556 次
  • 性别: Icon_minigender_1
  • 来自: 南京
最近访客 更多访客>>
社区版块
存档分类
最新评论

PracticalRichfaces_chap4要点

阅读更多
chp4
1. eventsQueue属性
In other words, any subsequent request put into the queue will abort the earlier one that hasn’t been sent yet.(头一次输入一个字,后面在等待队列事件时候输入了八个字,等第一个请求come back后8个字为一个队列)

2. requestDelay属性
和eventsQueue连用。2个条件1前一个请求come back 2requestDelay时间到

3. ignoreDupResponses属性
With ingoreDupResponses, the response will not be processed only if another request has been queued or already sent from the same component. Once the response has been ignored, the waiting request is sent.If ignoreDupResponse is set but eventsQueue is not specified, a default event queue will be created using the component ID.

4. JavaScript Interactions
onsubmit: Just before Ajax request is sent
onbeforedomupdate: Before any DOM updates are processed
oncomplete: After DOM updates have been processed

<a4j:commandButton value="Submit" reRender="out"
              data="#{bean.text}"
              oncomplete="alert(data)"/>
data属性will be serialized in JSON format and available on the client side.

5. 提高性能的用户体验度的要素
Using eventsQueue and requestDelay

Using bypassUpdates(只要validating时候When just validating form values, set ypassUpdates="true". When set to true, the Update Model and Invoke Application phases will not be invoked, improving response time)

Use <a4j:region> to limit what is processed on the server to improve performance.若renderRegionOnly为true,it will limit client (browser) updates to the current region only
<a4j:region renderRegionOnly="true">
        <h:inputText />
        <a4j:commandButton reRender="out1, out2"/>
        <h:outputText id="out1"/>
</a4j:region>
<h:outputText id="out2"/>
<a4j:outputPanel ajaxRendered="true">
        <h:outputText id="out3"/>
</a4j:outputPanel>
只会更新regin中的内容

<a4j:region>另外一个属性selfRendered
为true时候 it will render page
markup directly from the component tree without rebuilding the tree from page code
但它doesn't contain any transient components such as plain text and HTML tags.

ajxaSingle属性
在Validating User Input里很重要,Setting ajaxSingle="true" means that only that component will be processed on the server.也可以在指定的组件外面套(<a4j:region>)

6.<a4j:actionparam>和<f:setPropertyActionListner>很类似,区别在于
   <a4j:actionparam name="channel" value="#{channel}"
                                           assignTo="#{channelView.selectedChannel}"
                                            converter="channelConverter"/>
 
   <f:setPropertyActionListner value="#{channel}"
                    assignTo="#{channelView.selectedChannel}" />不需要转换

7. <a4j:status> defines two facets, stop and start, which work basically the same way as startText and stopText:
<a4j:status id="stateStatus">
    <f:facet name="start">
        <h:graphicImage value="/Ajax-loader.gif"/>
    </f:facet>
</a4j:status>
I decided not to define the stop facet in this example,you need to use <h:panelGroup> to group the components because <f:facet> allows only one child.

8.<a4:include>可以实现页面在include的地方导航,非常适合做向导应用,而<a4j:keepAlive>allows you to keep a bean alive for longer than a request but
less than a session,如设置了ajaxOnly="true"那对于非ajax请求数据将不会保持住

9. <a4j:ajaxListener>
Because it is invoked during Render Response, you are always guaranteed it will be invoked.
Executing the value change listener or action listener can be affected by validation or other events during the execution of the phases and can also be skipped.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics