RichFaces Interview Questions and Answers
Freshers / Beginner level questions & answers
Ques 1. What is RichFaces?
RichFaces is a JSF component library that consists of two main parts:
- A full set of AJAX enabled components in two libraries
- a4j: page centric AJAX controls
- rich: self contained, ready to use components
- Client-side validation, expanding JSR 303 Bean Validation all the way to the browser.
- Advanced queueing to match the high performance requirements of real world enterprise applications.
- Push component upgrades including JavaMessaging Service (JMS) integrations, and various transport mechanisms based on browser support.
- Our own Component Development Kit (CDK).
- Comprehensive documentation covering development best practices, and component details.
- Detailed and automated testing facilities for components, actions, listeners, and pages.
- Broad cross-browser support
- Large and active community at its foundation!!
Ques 2. What are the basic configurations of web.xml for Rich Faces?
Ques 3. Give some examples of RichFaces Components.
Ques 4. Give some examples of a4j components.
Some examples of a4j components:
- <a4j:commandLink>
- <a4j:commandButton>
- <a4j:outputPanel>
- <a4j:region>
- <a4j:mediaOutput>
- <a4j:queue>
Ques 5. 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.
Ques 6. What is rich:tooltip in RichFaces?
The rich:tooltip component creates a small non-modal pop-up that can be used to display additional information for nearly anything on the page.
Intermediate / 1 to 5 years experienced level questions & answers
Ques 7. How to pass parameters to a4j:commandButton?
See the example to pass parameters to a4j command button:
Ques 8. How to send and ajax request?
Ques 9. How to upload files in richfaces?
Using rich:fileUplaod.
Ques 10. What is a4j:param in RichFaces?
<
a4j:commandButton
value
=
"Update Name"
render
=
"rep"
>
<
a4j:param
value
=
"WithoutBook"
assignTo
=
"#{bean.name}"
/>
</
a4j:commandButton
>
Ques 11. What is a4j:status in RichFaces?
The a4j:status component is an indicator of an Ajax request. It has two states: start and stop. The start state indicates that an Ajax request is in progress. When an Ajax Response is returned, the component switches to the stop state. Give a loading progress on a ajax call:
<rich:modalPanel id="statusModalPanelId" autosized="true" resizeable="false">
<h:graphicImage value="/views/images/loading.gif"/>
<a4j:status id="statusId" onstop="Richfaces.hideModalPanel('statusModalPanelId');">
<f:facet name="start"></f:facet>
</a4j:status>
</rich:modalPanel>
Ques 12. What is rich:messages in RichFaces?
rich:messages is an extension for a standard h:messages component. In addition to what the standard component provides, rich:messages:
<
rich:messages
ajaxRendered
=
"true"
/>
Ques 13. What is rich:dataGrid in RichFaces?
The rich:dataGrid component accepts the same data sources as other iteration components and renders them in a grid format, the same way as the h:PanelGrid component does for in-line data. To define the grid's properties and styles, use the same definitions as for the h:panelGrid component.
<
rich:dataGrid
value
=
"#{bean.allEmployees}"
var
=
"emp"
columns
=
"3"
elements
=
"9"
width
=
"600px"
border
=
"0"
>
<
rich:panel
bodyClass
=
"pbody"
>
<
f:facet
name
=
"header"
>
<
h:outputText
value
=
"#{emp.name} #{emp.code}"
></
h:outputText
>
</
f:facet
>
<
h:panelGrid
columns
=
"2"
>
<
h:outputText
value
=
"Salary:"
styleClass
=
"label"
></
h:outputText
>
Is it helpful?
Add Comment
View Comments
Ques 14. What is rich:calendar in RichFaces?
The rich:calendar component allows you to select a date using a monthly calendar widget. It is possible to use the component in a popup or inline mode. In popup mode the calendar is initially rendered as an input for date with a button on the right side to trigger the popup. For inline mode, the monthly calendar is rendered on the page initially.
<
rich:calendar
value
=
"#{calendarBean.dateSelected}"
id
=
"calendar"
locale
=
"#{calendarBean.locale}"
popup
=
"#{calendarBean.popup}"
datePattern
=
"#{calendarBean.pattern}"
showApplyButton
=
"#{calendarBean.showApply}"
cellWidth
=
"24px"
cellHeight
=
"22px"
style
=
"width:200px"
disabled
=
"#{calendarBean.disabled}"
>
</
rich:calendar
>
Experienced / Expert level questions & answers
Ques 15. What is <a4j:support> tag?
Sends an
Ques 16. How to control traffic in RichFaces?
Ques 17. How to keep a managed bean between requests?
Ques 18. How to different skins are runtime?
Ques 19. Tell me about a4j:outputPanel and ajaxRendered?
"ajaxRendered" attribute of the <a4j:outputPanel> set to "true" allows to define the area of the page that will be re-rendered even if it is not pointed in the reRender attribute explicitly. It might be useful if you have an area on a page that should be updated as a response on any
Ques 20. What is limitToList attribute?
Ques 21. What is the use of eventsQueue?
Ques 22. How to handle request errors and session expire on client side?
Ques 23. 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"
/>
Ques 24. 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:
- By listener method, using the listener attribute.
- By listener class, using the type attribute.
- By object binding, using the binding attribute.
<
h:commandButton
value
=
"Update"
>
<
a4j:actionListener
listener
=
"#{bean.actionMethod}"
/>
<
f:ajax
render
=
"messages"
/>
</
h:commandButton
>
Ques 25. 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
>
Ques 26. What is rich:tree in RichFaces?
The rich:tree component renders a tree control on the page. The most important tree features include the following:
- Native support for Ajax operations
- Support for ajax, client, and server switch types
- Selection capabilities
- Flexible look and feel
<
rich:tree
id
=
"tree"
nodeType
=
"#{node.type}"
var
=
"node"
value
=
"#{bean.rootNodes}"
toggleType
=
"client"
selectionType
=
"ajax"
selectionChangeListener
=
"#{bean.selectionChanged}"
>
<
rich:treeNode
type
=
"country"
>
#{node.name}
</
rich:treeNode
>
<
rich:treeNode
type
=
"company"
iconExpanded
=
"/images/ctry.gif"
iconCollapsed
=
"/images/tree/disc.gif"
>
#{node.name}
</
rich:treeNode
>
<
rich:treeNode
type
=
"cd"
iconLeaf
=
"/images/tree/cd.gif"
>
#{node.artist} - #{node.name} - #{node.year}
</
rich:treeNode
>
Is it helpful?
Add Comment
View Comments
Most helpful rated by users:
- What is RichFaces?
- What is rich:dataGrid in RichFaces?
- What are the basic configurations of web.xml for Rich Faces?
- What is limitToList attribute?
- What is rich:messages in RichFaces?