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 dev
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 layout attribute value of spread. Here's an example of the
...
...
...
...
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.
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 As to applying CSS, it isn't that hard, every JSF HTML component has a 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. which generates 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 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? or JSF
for layout. Just use HTML to let JSF generate a HTML 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)., , 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 should be done as#form\:input {
background: gray;
}
NamingContainer. See also: