This tag is used to provide the menu items and sub items. The label for the item is set using itemLabel attribute and the action which is to perform is specified in action attribute. The icon displayed before the item is set to the icon attribute. Its split attribute is used when we want its sub items. So we have several options to render it differentley.
Code Description :
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%> <html> <body> <f:view> <h:form> <t:jscookMenu layout="hbr" theme="ThemeIE" > <t:navigationMenuItem id="nmi1" itemLabel="Menu1"> <t:navigationMenuItem id="nmi1_1" itemLabel="Menu11" action="welcome" icon="images/round.gif"/> <t:navigationMenuItem id="nmi1_2" itemLabel="menu12" action="welcome" icon="images/round.gif" /> <t:navigationMenuItem id="nmi1_3" itemLabel="menu13" action="welcome" icon="images/round.gif" /> <t:navigationMenuItem id="nmi1_4" itemLabel="menu14" icon="images/arrow.gif" split="true"> <t:navigationMenuItem id="nmi14_1" itemLabel="menu141" action="welcome" icon="images/round.gif" /> <t:navigationMenuItem id="nmi14_2" itemLabel="menu142" action="welcome" icon="images/round.gif" /> <t:navigationMenuItem id="nmi14_3" itemLabel="menu143" action="welcome" icon="images/round.gif" /> <t:navigationMenuItem id="nmi14_4" itemLabel="menu144" action="welcome" icon="images/round.gif" /> </t:navigationMenuItem> </t:navigationMenuItem> </t:jscookMenu> </h:form> </f:view> </body> </html>
Rendered Output :

Html Source Code :
<html>
<head>
<script type="text/javascript" src="/tomahawk_tags/faces
/myFacesExtensionResource/
org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/
11862282/
navmenu.jscookmenu.HtmlJSCookMenuRenderer/JSCookMenu.js"><!--
//--></script>
<script type="text/javascript" src="/tomahawk_tags/faces
/myFacesExtensionResource/
org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/
11862282/
navmenu.jscookmenu.HtmlJSCookMenuRenderer/MyFacesHack.js"><!--
//--></script>
<script type="text/javascript"><!--
var myThemeIEBase='/tomahawk_tags/faces/myFacesExtensionResource/
org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/
11862282/navmenu.jscookmenu.HtmlJSCookMenuRenderer/ThemeIE/';
//--></script>
<script type="text/javascript" src="/tomahawk_tags/faces
/myFacesExtensionResource/
org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/
11862282/navmenu.jscookmenu.HtmlJSCookMenuRenderer/
ThemeIE/theme.js"><!--
//--></script>
<link rel="stylesheet" href="/tomahawk_tags/
faces/myFacesExtensionResource/
org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/
11862282/navmenu.jscookmenu.HtmlJSCookMenuRenderer/
ThemeIE/theme.css" type="text/css" />
</head><body>
<form id="_idJsp0" name="_idJsp0" method="post"
action="/tomahawk_tags/pages/navigationMenuItem.jsf"
enctype="application/x-www-form-urlencoded">
<script type="text/javascript"><!--
var idJsp0__idJsp1_menu =
[[null, 'Menu1', null, '_idJsp0', null,['<img src="images/round.gif"/>',
'Menu11', 'idJsp0__idJsp1_menu:A]welcome', '_idJsp0', null],
['<img src="images/round.gif"/>', 'menu12', 'idJsp0__idJsp1_menu:A]welcome'
, '_idJsp0', null],
['<img src="images/round.gif"/>', 'menu13', 'idJsp0__idJsp1_menu:A]welcome',
'_idJsp0', null],
_cmSplit,['<img src="images/arrow.gif"/>', 'menu14', null, '_idJsp0', null,
['<img src="images/round.gif"/>', 'menu141', 'idJsp0__idJsp1_menu:A]welcome'
, '_idJsp0', null],
['<img src="images/round.gif"/>', 'menu142', 'idJsp0__idJsp1_menu:A]welcome',
'_idJsp0', null],
['<img src="images/round.gif"/>', 'menu143', 'idJsp0__idJsp1_menu:A]welcome',
'_idJsp0', null],
['<img src="images/round.gif"/>', 'menu144', 'idJsp0__idJsp1_menu:A]welcome',
'_idJsp0', null]]]];
//--></script><div id="idJsp0__idJsp1_menu"></div>
<script type="text/javascript"><!--
if(window.cmDraw!=undefined) { cmDraw ('idJsp0__idJsp1_menu',
idJsp0__idJsp1_menu, 'hbr', cmThemeIE, 'ThemeIE');}
//--></script>
<input type="hidden" name="_idJsp0_SUBMIT" value="1" />
<input type="hidden" name="jscook_action" />
<script type="text/javascript"><!--
function clear__5FidJsp0()
{
clearFormHiddenParams__idJsp0('_idJsp0');
}
function clearFormHiddenParams__idJsp0(currFormName)
{
var f = document.forms['_idJsp0'];
f.elements['jscook_action'].value='';
f.target='';
}
clearFormHiddenParams__idJsp0();
//--></script><input type="hidden" name="javax.faces.ViewState"
id="javax.faces.ViewState" value="rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7k
M5YnxBzKWwCAAB4cAAAAANzcgBHb3JnLmFwYWNoZS5teWZhY2VzLmFwcGxpY2F0aW9uLlRy
WVTdHJ1Y3R1cmVNYW5hZ2VyJFRyZWVTdHJ1Y3RDb21wb25lbnRGWRfYnEr2zwIABFsACV9j
aGlsZHJlbnQASltMb3JnL2FwYWNoZS9teWZhY2VzL2FwcGxpY2F0aW9uL1RyZWVTd" />
</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 navigationMenuItem tag
Post your Comment