Related differences

Ques 11. What is the use of eventsQueue?

Attribute "eventsQueue" defines the name of the queue that will be used to order upcoming Ajax requests. By default, RichFaces does not queue Ajax requests. If events are produced simultaneously, they will come to the server simultaneously. JSF implementations (especially, the very first ones) does not guaranty that the request that comes first will be served or passed into the JSF lifecycle first. The order how the server-side data will be modified in case of simultaneous request might be unpredictable. Usage of eventsQueue attribute allows to avoid possible mess.
The next request posted in the same queue will wait until the previos one is not processed and Ajax Response is returned back if the  "eventsQueue"  attribute is defined.
In addition, RichFaces starts to remove from the queue "similar" requests. "Similar'"requests are the requests produced by the same event.

Is it helpful? Add Comment View Comments
 

Ques 12. How to pass parameters to a4j:commandButton?

See the example to pass parameters to a4j command button:

<a4j:commandButton ajaxSingle="true" value="Update" reRender="name, job,
            out"  status="commonstatus">
            <a4j:actionparam name="n" value="Mark Joe"  assignTo="#{userBean.name}" />
            <a4j:actionparam name="j" value="WithoutBook"  assignTo="#{userBean.job}" />
</a4j:commandButton>
a4j:actionparam is the name by which you can get the value in your Handler/Bean.

Is it helpful? Add Comment View Comments
 

Ques 13. How to send and ajax request?

There are different ways to send Ajax requests from your JSF page. For example you can use <a4j:commandButton>  ,  <a4j:commandLink><a4j:poll>   or  <a4j:support>  tags or any other.
All these tags hide the usual JavaScript activities that are required for an  XMHTTPRequest object building and an Ajax request sending. Also, they allow you to decide which components of your JSF page are to be re-rendered as a result of the Ajax response (you can list the IDs of these components in the  "reRender"  attribute).

Is it helpful? Add Comment View Comments
 

Ques 14. How to handle request errors and session expire on client side?

Given an example below:
A4J.AJAX.onError = function(req, status, message){
    window.alert("Custom onError handler "+message);
}
A4J.AJAX.onExpired = function(loc, expiredMsg){
if(window.confirm("Custom onExpired handler "+expiredMsg+" for a location: "+loc)){
      return loc;
    } else {
     return false;
    }
}

Is it helpful? Add Comment View Comments
 

Ques 15. How to upload files in richfaces?

Using rich:fileUplaod.

rich:fileUpload is a component which provides files upload functionality and extends functionality of standard input with type=file.
We can have different characteristics with this component like: allowed file types, maximum files quantity, and immediate upload.
It supports immediate upload as soon as a file is selected with this component.
<rich:fileUpload  id="fileUploadId"
 autoclear="true"
 uploadListClass="uploadList"
 fileEntryClass="fileEntry"
 allowFlash="auto"
 styleClass="richFileUpload"
 fileUploadListener="#{handler.documentUpload}"
 maxFilesQuantity="#{constants.FILE_UPLOADLIMIT}"
 required="true"
 immediate="true"
 listHeight="1px"
 listWidth="71px"
 onupload="onFileUploadClick();"
 addControlLabel="#{constants.Label_Browse}"
 immediateUpload="true"
 noDuplicate="true"
 onadd="addFileListener(event)">
<a4j:support event="onuploadcomplete" immediate="true" reRender="hiddenVal,docTableId,uploadErrorGrid,docSelectedMsgID,exceptionMessageGrid"/>
</rich:fileUpload>

Is it helpful? Add Comment View Comments
 

Most helpful rated by users: