File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes JSF and styling in jsf components Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF and styling in jsf components" Watch "JSF and styling in jsf components" New topic

JSF and styling in jsf components

abhijeetpvpp mane

Joined: Jul 17, 2013
Posts: 2
Hi everyone,

I am new to jsf and i want o know the right way to link a css file and
adding style to jsf tags like command button etc.
And how to call this components using javascript.
I am using jsf 2.0 and xhtml.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Welcome to the JavaRanch, Abijeet!

CSS is best done as separate files referenced by the View Definitions (xhtml) that use them. JSF2 has some tags to make it fairly easy to do that.

JavaScript can be used by JSF views in pretty much the same way that it is in straight HTML, with one exception, and that is that when you attempt to locate a page element by its ID, the true (JavaScript/HTML) is a composite of the IDs of the "naming container" JSF components that contain it. When in doubt, use your browser's "show source" option to see the generated code. Any ID components that start with "j_" are probably automatically generated by an element that didn't have an explicit ID, and you should hunt them down and put "real" IDs on those items, since the automatically-generated IDs are likely to change suddenly and unexpectedly.

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