In this section "selectManyMenu" tag will be discussed. This is used to select more than one items from a set of options. This renders an html "select" element which contains "multiple" attribute with size "1". This renders the menu of options where only one is visible at a time. The difference between "selectManyListbox" and "selectManyMenu" is that listbox can be set to any size and menu is always set to size "1". Options can be added by the use of f:selectItem or f:selectItems. This tag can render different output in different browsers. In Internet Explorer browser user can select the items by scrolling the arrow icon up and down but its not the case for Mozilla or Netscape browser. In the later case this menu looks like an input text box but many of the items can be selected.
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:selectManyMenu id="smm" value="#{TableBean.perInfoAll}" title="select one or more items"> <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:selectManyMenu> </h:form> </body> </html> </f:view> |
Rendered Output :
1) In Mozilla browser :

2) In Internet Explorer :

Html Source Code:
|
<html> |
This tag can use some attributes that are useful in different places for different purpose. Here is the list of attributes :
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: JSF selectManyMenu Tag View All Comments
Post your Comment