• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Generating Horizontal Menu in JSF using h:dataTable

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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>

<h:outputText 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
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 24287
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A better approach is to use the JSCookMenu JSF control available with the MyFaces Tomahawk library.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic