Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

RichFaces Interview Questions and Answers

Ques 16. What is a4j:ajax?

a4j:ajax is one of our core behaviors, extending the base JSF 2.0 f:ajax tag. This tag triggers an Ajax request when the specified parent event is triggered.

<h:inputText value="#{userBean.name}">
    <a4j:ajax event="keyup" render="out" />
</h:inputText>
<h:outputText value="#{userBean.name}" id="out" />

Is it helpful? Add Comment View Comments
 

Ques 17. What is a4j:commandLink in RichFaces?

The a4j:commandLink combines the standard h:commandLink with our own a4j:ajax. This not only reduces typing, but also inherits all a4j:ajax special options.

<a4j:commandLink value="#{constants.Label_DateUploaded}" action="#{handler.tableHeaderListener}" ajaxSingle="true" reRender="claimDocTable" onclick="loadClaimDocs()" styleClass="tableHeaderTxt" oncomplete="completeClaimRender()">
       <f:setPropertyActionListener target="#{handler.sortField}" value="#{constants.Label_DateUploaded}"/>                                            
 </a4j:commandLink>

Is it helpful? Add Comment View Comments
 

Ques 18. What is a4j:actionListener in RichFaces?

Use a4j:actionListener to register an ActionListener class on a parent action component. Multiple listener methods can be registered on an action components in this way.

The a4j:actionListener tag differs from the standard JSF tag in that it allows the listener to be attached in any of three ways:

  1. By listener method, using the listener attribute.
  2. By listener class, using the type attribute.
  3. By object binding, using the binding attribute.
<h:commandButton value="Update">
    <a4j:actionListener listener="#{bean.actionMethod}"/>
    <f:ajax render="messages"/>
</h:commandButton>

Is it helpful? Add Comment View Comments
 

Ques 19. What is a4j:jsFunction in RichFaces?

The a4j:jsFunction component creates a JavaScript function that allows you to send JSF Ajax requests from any JavaScript. You define the Ajax and JSF properties just like a4j:ajax, or a4j:commandButton, and a4j:jsFunction creates the JavaScript for you. The component sends a request using the standard JSF mechanisms. Note that this means a JSF form is required.

The following example shows how to use a4j:jsFunction to create a function named updateName. This is then called on mouseover of the different names. This triggers the full round trip Ajax request and renders the updated name.

<span onmouseover="updateAddress('WithoutBook')" onmouseout="updateAddress('')">WithoutBook</span>

<a4j:jsFunction name="updateAddress" render="showAddress">
    <a4j:param name="address" assignTo="#{bean.address}" />
</a4j:jsFunction>

Is it helpful? Add Comment View Comments
 

Ques 20. What is a4j:param in RichFaces?

The a4j:param component extends the regular f:param tag. The primary extension is the ability to assign a value to a property on a managed bean directly using the assignTo attribute. Using this feature you can update model values without invoking a single line code.

<a4j:commandButton value="Update Name" render="rep">
    <a4j:param value="WithoutBook" assignTo="#{bean.name}" />
</a4j:commandButton>

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

©2024 WithoutBook