Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 485007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:21:27+00:00 2026-05-13T01:21:27+00:00

I want to look at using JSF but I’m put off by what appears

  • 0

I want to look at using JSF but I’m put off by what appears to be the liberal use of html tables for layout by many components.

How do you go about using JSF to develop css-based layouts?


I seem to be labouring under a misaprehension here, but every JSF tutorial I’ve seen ends up producing table-based HTML layouts. I’ve also looked at RichFaces and IceFaces demos and there’s an awful lot of tables-for-layout there as well.

Does anyone know of a JSF tutorial that develops a CSS based layout? If not, does anybody fancy making one? 😉

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T01:21:28+00:00Added an answer on May 13, 2026 at 1:21 am

    the liberal use of html tables for layout by many components

    Many components? There are as far as I know only two which do that “unnecessarily”: the <h:selectOneRadio> and <h:selectManyCheckbox>. If you want a table-less group of radiobuttons and checkboxes wherein you have the full control over the generated markup, just use the Tomahawk variant instead, which has an extra layout attribute value of spread. Here’s an example of the <t:selectOneRadio> approach:

    <t:selectOneRadio id="foo" value="#{bean.foo}" layout="spread">
        <f:selectItems value="#{bean.foos}" />
    </t:selectOneRadio>
    ...
    <t:radio for="foo" index="0" />
    ...
    <t:radio for="foo" index="1" />
    ...
    <t:radio for="foo" index="2" />
    ...
    

    Since JSF 2.2 it’s even possible to do it “out the box” with new passthrough elements/attributes feature. Since JSF 2.3 it has even become part of standard component set. See also a.o. <h:selectOneRadio> renders table element, how to avoid this?

    For the remainder, you just have the control of the general HTML output fully in your own hands. Just do not use tables for layout at all. I.e. do not use HTML <table> or JSF <h:panelGrid> for layout. Just use HTML <div> elements to display content blocks. Or if you’re a JSF-purist, you can use <h:panelGroup layout="block"> to let JSF generate a HTML <div> element.

    As to applying CSS, it isn’t that hard, every JSF HTML component has a styleClass attribute wherein you can specify CSS classes (which would end up in a HTML class attribute) and style attribute wherein you can specify inline CSS (which would end up in a HTML style attribute).

    You can even define global CSS styles and use the ID selectors. Only thing which you need to take care in JSF+CSS is that the JSF-generated HTML element IDs are prepended with the IDs of all parent NamingContainer components (e.g. <h:form>, <h:dataTable>, etc) with a colon : as separator. As the colon is an illegal character in CSS identifiers, you need to escape it using \. So styling the input element of for example

    <h:form id="form">
        <h:inputText id="input" ... />
    

    which generates <input type="text" id="form:input" ... /> should be done as

    #form\:input {
        background: gray;
    }
    

    It’s however very rare to select form input elements or table elements by ID. More commonly the classname is to be used (which is more semantic and better reuseable) and this doesn’t need to be escaped. The ID are usually used by main layout components only anyway (header, menu, content, footer, title, etc) and they usually don’t end up in a JSF NamingContainer.

    See also:

    • How to use JSF generated HTML element ID with colon ":" in CSS selectors?
    • By default, JSF generates unusable ids, which are incompatible with css part of web standards
    • What is the need of JSF, when UI can be achieved from CSS, HTML, JavaScript, jQuery?
    • JavaServer Faces 2.2 and HTML5 support, why is XHTML still being used

    I seem to be labouring under a misaprehension here, but every JSF tutorial I’ve seen ends up producing table-based HTML layouts. I’ve also looked at RichFaces and IceFaces demos and there’s an awful lot of tables-for-layout there as well.

    Start here: Java EE web development, where do I start and what skills do I need?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

as I'm using Cufon's on my website, but also want to make it look
I have innoDB table using numerous foreign keys, but we just want to look
I want to query my MySQL database using prepared statements. The query should look
If I have two tables, Customers and Orders, and I want to look up
I have divs containing round brackets that I want to look for using the
i narrowed down what i want my wpf button to look like using XAML.
I am working on a web app using JSF w/Seam. I want to be
I want to look up a property of a Javascript object using a string
While using Vim I'll sometimes want to look at a function definition or a
I'm using a vim plugin and when I want to look up a function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.