Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating Horizontal Menu in JSF using h:dataTable

 
munikrishna macherlla
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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">

<h:column>

<hutputText value="#{item.name}"/>

</h:column>

</h:dataTable>

but which renders like this

Menu1

Menu2

Menu3...



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
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
That cannot be done using datatable.If needed i can be done using jstl tag
by using html tags in between jstl tags...

thanks
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18009
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A better approach is to use the JSCookMenu JSF control available with the MyFaces Tomahawk library.
 
chloe wong
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
A
B
C

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




I hope this is what you are looking for.
 
oane derossebrune
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic