• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF and styling in jsf components

 
abhijeetpvpp mane
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks.
 
Tim Holloway
Saloon Keeper
Posts: 18304
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic