Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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: 25851
184
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic