Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

JSF selectItem Tag

In this section you will learn about the selectItem tag. It can be used with any select tag of JSF html tag library.


JSF Tutorials: Easy steps to learn JSF Java Server Faces (JSF) Tutorials What is JSF Mojarra? JSF Life Cycle JSF Examples JSF Tutorial For Beginners Roseindia JSF Tutorial JSF core Tag Reference JSF internationalization example Tomahawk selectOneCountry tag RCFaces About Hibernate, Spring and JSF Integration Tutorial Creating Login Page In JSF using NetBeans JSF Hello World Declaring the Bean class in the faces-config.xml file Creating a Web Application with the JSF Framework Binding the Form Elements With the Bean Properties Adding Navigation in JSF Application Binding Component Instance to a Bean Property Tomahawk validateEqual tag Tomahawk validateEmail tag Tomahawk validateCreditCard tag Tomahawk selectOneListbox tag Tomahawk selectManyListbox tag Tomahawk selectManyCheckbox tag Tomahawk selectBooleanCheckbox tag Tomahawk saveState tag Tomahawk popup tag Tomahawk inputCalendar tag Tomahawk htmlTag tag Tomahawk graphicImage tag Tomahawk documentHead tag Tomahawk documentBody tag Tomahawk document tag Tomahawk column tag DataBase Connectivity with MySql in Visual Web JSF Application Using Net Beans IDE Retrieve Image in JSF From MySQL Table Using NetBeans IDE JSF Training Java Sever Faces 1.2 - JSF 1.2 Display Data from Database in JSF Application Business Objects of Business Logic tier Setup MySQL Database Working with Database through JDBC Working with JavaScript & CSS Referencing a Localized Message Referencing Resource Bundle from a Page Binding Component Value to an Implicit Object Phase Listener Value Change Event Listener Action Event Listener

JSF selectItem Tag


This tag is used to add a child component to the component associated with the enclosing tag. In this section you will learn about the selectItem tag. It can be used with any select tag of JSF html tag library. It renders "option" element when converted to html. In the example below selectItem tag has been used within selectManyListbox tag. So these are the child components of List Box component and these child components provides options for the List Box component. 

Code Description :

<%@ taglib uri="" prefix="h"%>
<%@ taglib uri="" prefix="f"%>

<h:outputText value="Select windows to open"/><br><br>
<h:selectManyListbox id="subscriptions" value="#{TableBean.perInfoAll}" size="3">
<f:selectItem id="si1" itemLabel="window1" itemValue="w1" />
<f:selectItem id="si2" itemLabel="window2" itemValue="w2" />
<f:selectItem id="si3" itemLabel="window3" itemValue="w3" />
<f:selectItem id="si4" itemLabel="window4" itemValue="w4" />
<f:selectItem id="si5" itemLabel="window5" itemValue="w5" />
<f:selectItem id="si6" itemLabel="window6" itemValue="w6" />


Rendered Output :

Html Source Code :

<form id="_id0" method="post" action="/coretag/pages/selectItem.jsf" enctype="application/x-www-form-urlencoded">

Select windows to open<br><br>
<select id="_id0:subscriptions" name="_id0:subscriptions" multiple size="3"> 

<option value="w1">window1</option>
<option value="w2">window2</option>
<option value="w3">window3</option>
<option value="w4">window4</option>
<option value="w5">window5</option>
<option value="w6">window6</option>

<input type="hidden" name="_id0" value="_id0" /></form>


This tag contains some attributes :

id : This is used to uniquely identify the table component. This must be unique within the closest parent component.
binding : It is a value binding expression that is used to link component to a property in a backing bean.
itemLabel : This is used to set the label for the option rendered by this tag.
itemValue : This is used to set the value for the option rendered by this tag. This value is used at server when option is selected.
value : This is the value binding expression that indicates to the selectItem instance which contains the information about the option.
itemDescription : It is used to describe something about this option for your own purpose.
itemDisabled : This is a boolean attribute and is used to make the option enable or disable when it is set to "true" and "false" respectively. Its default value is "false".


Share on Google+Share on Google+

JSF selectItem Tag

Posted on: June 15, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: JSF selectItem Tag   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image