• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF and styling in jsf components

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic