File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 17410

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: CSS in JSF
It's not a secret anymore!