Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JSF selectManyListbox Tag 
 

This section is dedicated to describe you about selectManyListbox tag. This lets you select more than one options from a set of available options.

 

JSF selectManyListbox Tag

                          

This section is dedicated to describe you about selectManyListbox tag. This lets you select more than one options from a set of available options. It renders an html "select" element of specified size with "multiple" attribute. size is used to specify how many options are to be displayed at a time. If size is not specified then it displays all the choices i.e. its default value is equal to no. of  available options. If we set this size to "1" then drop down list is rendered. Instead of doing this we can use "selectManyMenu" tag of JSF. If  size is specified less than the total no. of available options then scroll bar is rendered which can be used to see all the options by moving it. Options are added by the use of f:selectItem or f:selectItems.

Code Description :

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<f:view>
 <html>
  <body>
   <h:form>
      <h:selectManyListbox id="subscriptions" value="#{TableBean.perInfoAll}"
title="select one or more options by pressing the control key" size="3">
  <f:selectItem id="si1" itemLabel="Thums Up" itemValue="11" />
  <f:selectItem id="si2" itemLabel="Limca" itemValue="22" />
  <f:selectItem id="si3" itemLabel="Pepsi" itemValue="33" />
  <f:selectItem id="si4" itemLabel="Sprite" itemValue="44" />
  <f:selectItem id="si5" itemLabel="Frooti" itemValue="55" />
  <f:selectItem id="si6" itemLabel="Coca-Cola" itemValue="66" />
      </h:selectManyListbox>
   </h:form>
  </body>
 </html>
</f:view>

Rendered Output :

Html Source Code:

<html>
 <body>
  <form id="_id0" method="post" action="/htmltag/pages/selectManyListbox.jsf"
enctype="application/x-www-form-urlencoded">
     <select id="_id0:subscriptions" name="_id0:subscriptions" multiple size="3"
title
="select one or more options by pressing the control key">
         <option value="11">Thums Up</option>
         <option value="22">Limca</option>
         <option value="33">Pepsi</option>
         <option value="44">Sprite</option>
         <option value="55">Frooti</option>
         <option value="66">Coca-Cola</option>
    </select>
         <input type="hidden" name="_id0" value="_id0" />
   </form>
 </body>
</html>

This tag can use some attributes that are useful in different places for different purpose. Here is the list of attributes : 

  • id : This attribute is used to uniquely identify the element within the closest container. 
  • size : It is used to determine how many options have to be shown at a time from the list of available options. If it is not specified then all are shown. If size is set to less than the number of available options then scroll bar is rendered. 
  • enabledClass : This attribute is used to set the CSS class to the label of disabled choices.
  • disabledClass : This attribute is used to set the CSS class to the label of enabled choices.
  • binding : It takes the value binding expression that is used to link the component to the property of the backing bean. 
  • rendered : Its a boolean attribute. Its default value is true. It determines whether this component should be rendered or not. 
  • value : This is to set the current value of the component. 
  • converter : This specifies the converter for the component. This can be static value or EL expression . 
  • immediate : Its a boolean attribute. It is used to identify during which phase value change event should occur. If this attribute is set to true then in place of firing the event during the process validation phase, these event are sent immadiately at the end of apply request values phase. 
  • required : Its a boolean attribute. It indicates that its value is required by the user before the submission of the form to the server. If it is set to true and value is not provided then an error message comes.
  • validator : It takes the method binding expression. This expression represents the validator method. This method is called at the time of validation of the component. 
  • valueChangeListener : This also takes a method binding expression. This expression represents value change listener method. This method will be called when new value is set for this component. 
  • dir : It is used to set the direction of the text to be displayed. It can take two values LTR(left to right) and RTL (right to left). 
  • lang : It is used to set the base language of the component when displayed. 
  • style : It is used to set the CSS style definition for the component. 
  • title : It is the standard html attribute.It is used to set the tooltip text for this component. 
  • styleClass : It is used to set the CSS class for the component. 
  • onclick : Script to be invoked when the element is clicked. 
  • ondblclick : It is used for Java Script code to be invoked when the element is double-clicked. 
  • onmousedown : It is used for Java Script code to be invoked when the pointing device is pressed over this element. 
  • onmouseup : It is used for Java Script code to be invoked when the pointing device is released over this element. 
  • onmouseover : It is used for Java Script code to be invoked when the pointing device is moved into this element. 
  • onmousemove : It is used for Java Script code to be invoked when the pointing device is moved while it is in this element. 
  • onmouseout : It is used for Java Script code to be invoked when the pointing device is moves out of this element. 
  • onkeypress : It is used for Java Script code to be invoked when a key is pressed over this element. 
  • onkeydown : It is used for Java Script code to be invoked when a key is pressed down over this element. 
  • onkeyup : It is used for Java Script code to be invoked when a key is released over this element. 
  • accesskey : This is standard html attribute. It is used to set the access key for the element which is used to send the focus to the element when pressed. 
  • disabled : Its a boolean attribute. This is used to disable the element to receive focus, when it is set to true. 
  • onblur : It is used to set the java script code to execute when focus is lost from the element. 
  • onfocus : It is used to set the java script code to execute when focus is received by the element. 
  • onchange : It is used to set the java script code to execute when element is modified. 
  • onselect : It is used to set the java script code to execute when element is modified 
  • readonly : Its a boolean attribute. It is used to indicate the user that its value can't be modified, if it is set to true. 
  • tabindex : This is a standard html attribute. It is used to set the order of receiving the focus on the movement of TAB key by the user.

                          

» View all related tutorials
Related Tags: c com memory server dynamic tree components core component tag name this node oo ibm create root like for example

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

3 comments so far (
post your own) View All Comments Latest 10 Comments:

hi,
I wanted to know that how i can show the default value as selected.

Posted by mayank on Monday, 01.7.08 @ 16:10pm | #44711

Rashedul: The implementation for perInfoAll in the backing bean should be a string array with its getter and setter. Sample implementation can be:
private String perInfoAll[]; public String[] getPerInfoAll() {
return perInfoAll;
}
public void setPerInfoAll(String perInfoAll[]) {
this.perInfoAll = perInfoAll;
}

Posted by Ming Chang on Thursday, 08.16.07 @ 13:44pm | #23501

I need to know how'll I write the bean property for accepting value in selectManyListbox in the example given above which is value="#{TableBean.perInfoAll}". Now I want to know how the property perInfoAl is written.

Posted by Rashedul Hasan on Saturday, 05.26.07 @ 13:32pm | #17337

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.