• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)

Creating simple toolbar using RichFaces tag library

July 19, 2008 //  by Krishna Srinivasan//  Leave a Comment

rich:toolBar, rich:dropDownMenu and rich:menuItem

This example demonstrates how to create simple toolbar using RichFaces tag library. RichFaces provides predefined tags like rich:toolBar which will be easily plugged into our webpages to display the toolbar component. Apart from rich:toolBar, to create menus we have to use other tags rich:dropDownMenu and rich:menuItem.

also read:

  • Introduction to JSF
  • JSF Interview Questions
  • Request Processing Lifecycle phases in JSF

rich:dropDownMenu is used for creating the group of menus and inside that use rich:menuItem to add a single menu. You can view the image in this article bottom to know how it looks like.

richfaces.jsp

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="rich" uri="http://richfaces.org/rich" %>
<%@ taglib prefix="a4j" uri="http://richfaces.org/a4j"%>
<html>
    <body>
        <f:view>
            <h:form>
                <rich:toolBar>
                    <rich:dropDownMenu>
                        <f:facet name="label">
                            <h:outputText value="File"/>
                        </f:facet>
                        <rich:menuItem value="New"/>
                        <rich:menuItem value="Open"/>
                        <rich:menuItem value="Exit"/>
                    </rich:dropDownMenu>
                    <rich:dropDownMenu>
                        <f:facet name="label">
                            <h:outputText value="Edit"/>
                        </f:facet>
                        <rich:menuItem value="Find"/>
                        <rich:menuItem value="Replace"/>
                    </rich:dropDownMenu>
                </rich:toolBar>
            </h:form>
        </f:view>
    </body>
</html>

view in browser

rich-1

Category: JSFTag: Richfaces

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Previous Post: « Use rich:datascroller for rich:dataTable pagination
Next Post: How to Configure hibernate using XML files? »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

EJB 3.0 Timer Services

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Introductiion to Jakarta Struts

What’s new in Struts 2.0? – Struts 2.0 Framework

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact