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"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<f:view>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>t:selectManyMenu example</title>
<style type="text/css">
<!--
body{
background-color:#fff2f2;
margin-top:30;
}
-->
</style>
</head>
<body >
<h:form><center>
<t:outputText value="Choose any one from the list ahead :"/>
<t:selectManyMenu id="som" >
<f:selectItem id="si1" itemLabel="Samsung" itemValue="sa" />
<f:selectItem id="si2" itemLabel="Logitech" itemValue="lo" />
<f:selectItem id="si3" itemLabel="LG" itemValue="lg" />
<f:selectItem id="si4" itemLabel="BenQ" itemValue="bq" />
</t:selectManyMenu>
</center></h:form>
</body>
</html>
</f:view>
Rendered Output : In Mozilla browser :

In Internet Explorer :

Html Source Code :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<title>t:selectManyMenu example</title>
<style type="text/css">
<!--
body{
background-color:#fff2f2;
margin-top:30;
}
-->
</style>
</head>
<body >
<form id="_idJsp0" name="_idJsp0" method="post"
action="/tomahawk_tags/pages/selectManyMenu.jsf"
enctype="application/x-www-form-urlencoded">
<center>Choose any one from the list ahead :
<select id="_idJsp0:som" name="_idJsp0:som"
multiple="multiple" size="1">
<option value="sa">Samsung</option>
<option value="lo">Logitech</option>
<option value="lg">LG</option>
<option value="bq">BenQ</option>
</select>
</center>
<input type="hidden" name="_idJsp0_SUBMIT" value="1" />
<input type="hidden" name="javax.faces.ViewState"
id="javax.faces.ViewState" value="rO0ABXVyABNbTGphdmEubGFuZ
y5PYmplY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAEycHQAGS9wYWdlcy9zZWxl
Y3RNYW55TWVudS5qc3A=" /></form>
<!-- MYFACES JAVASCRIPT -->
</body>
</html>
|
This tag contains attributes given below :
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: Tomahawk selectManyMenu tag
Post your Comment