This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes CSS in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "CSS in JSF" Watch "CSS in JSF" New topic


Oda Jr

Joined: Jun 09, 2012
Posts: 1
Hello there =)

Really need some help.

I'm newbie in JSF. I am facing problems in using css to customize my web and also involved the used of FancySliding(Jquery). The problem is I want to create something like this

Form SLider

But, I messed up my code because of the tag. I noticed there are too many different tag used by html and jsf and now I'm confused in using some tag such as div and panelGroup etc....

This is my code

I'm using netbean right now because I need to make connection between my page and oracle database. I hope you can showed what are wrong here.
I have included my full source code incase you want to run it in netbean and also the code for Fancy Sliding.

My web code:

FancySLiding code:

Thank in advance.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15962

Welcome to the JavaRanch, Oda! Please correct your display name as soon as possible.

As a rule, I don't recommend using raw HTML in JSF View definitions. Although it's not as likely to actually scramble the display these days, HTML does limit your ability to cross-render to other display media and in most cases there's a JSF equivalent.

For "div" or "p", a simple h:panelGrid can be used to create a 1x1 grid.

For "span", usually you can use h:outputText

For "list", a panelGrid or dataTable usually suffices (some say that the "ul" and "ol" constructs are obsolete even in straight HTML).

For "table", use a panelGrid or dataTable.

Avoid ui:repeat unless there is no alternative. Most of the things that people use ui:repeat on work better in dataTable.

It's good practice to provide an "id=" attribute on the container tags such as h:form, h:panelGrid, h:dataTable.

The header tags (h1, h2, ...) can often be eliminated when using a grid or table, since they support header and footer elements (facets).

I can't tell from your sample why there might be a problem with the jQuery slider, but in cases where you put jQuery directly on a JSF View definition, it's recommended to use the long-form ("jQuery.") syntax, not the shortcut "$", since the JSF EL processor may mis-interpret it.

I've also found it cleaner to place my CSS definitions in external files and not in the view definition. The "f:verbatim" tag can be used to wrap the CSS style tag if that's not convenient. Use f:verbatim + XML "CDATA" for JavaScript on the View definition (or move the JavaScript to an external file). JavaScript has syntax that can confuse the XML processor that parses the JSF View definition.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: CSS in JSF
Similar Threads
JSF - Missing source code using templating and composition
Issue with my webApp
JSP <a href> tags breaks page functionality
Multipart request problem
Radio slected should populate the Input text box