File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Generating Horizontal Menu in JSF using h:dataTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Generating Horizontal Menu in JSF using h:dataTable" Watch "Generating Horizontal Menu in JSF using h:dataTable" New topic

Generating Horizontal Menu in JSF using h:dataTable

munikrishna macherlla

Joined: May 15, 2007
Posts: 1
I have to populate the menu dynamically from the database in JSF

am able populate the menus using the following code

<h:dataTable id="menu" value="#{menu.list}" var="item">


<hutputText value="#{}"/>



but which renders like this




but I want to display these menu in horizontal like

Menu1 Menu2 Menu3

Can you please suggest me on this?

Is it possible in h:dataTable
mano ranjan
Ranch Hand

Joined: Jul 12, 2007
Posts: 102
That cannot be done using datatable.If needed i can be done using jstl tag
by using html tags in between jstl tags...

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

A better approach is to use the JSCookMenu JSF control available with the MyFaces Tomahawk library.

An IDE is no substitute for an Intelligent Developer.
chloe wong

Joined: Aug 02, 2006
Posts: 17
As a matter of fact, it can be done. You have to use dataList instead of dataTable. Assuming you have list in A,B,C..

dataTable will print list in:

where as dataList will print in A B C D ...

I hope this is what you are looking for.
oane derossebrune

Joined: May 14, 2008
Posts: 1
There is also another way. You can define columnClasses and rowClasses to the datatable. This makes it posible to use CSS and position your elements anywhere you like on the page.
I agree. Here's the link:
subject: Generating Horizontal Menu in JSF using h:dataTable
jQuery in Action, 3rd edition