0

Am working on a time tracker application using jsf. i have done with the validation part . Now can any one help me out how to implement CSS and JS in the jsf.

Thanks in advance.

vinay
  • 11
  • 1
  • 3

3 Answers3

2

There is nothing special. You can do it in the same way it's done without jsf. Here is some examples: http://www.ibm.com/developerworks/web/library/wa-aj-jsfcss1/index.html

BrownFurSeal
  • 515
  • 3
  • 8
0

The point of using JSF is to avoid writing JavaScript unless it is absolutely necessary. JSF allows you to specify the .css file or to skin the complete application using an already available skin which would vary depending on your choice of JSF implementation. You just need to add one tag to your faces-config.xml.

<skin-family>myskin</skin-family>

If you can be more specific regarding what you are trying to accomplish through JS, I am sure that BalusC and others here will suggest you an easier way to do it through JSF itself..

Community
  • 1
  • 1
RHT
  • 4,974
  • 3
  • 26
  • 32
0

There are different solutions to your question, depending on what you want to do.

  1. You can use

    <h:outputScript ... />
    <h:outputStylesheet ... />
    

    to include certain scripts or stylesheets in a page.

  2. You could use a template to include standard-stylesheets and scripts that should be available on every page.

  3. You could use the "styleClass" and "style" attributes of JSF components for CSS-Styling and the JS event handler like onclick, onblur, etc. to invoke any javascript you like.

HTH

tasel
  • 629
  • 5
  • 15