-3

I tried to make it work for over 2 hours before I gave up.

Using JSF (the Woodstock Library) is required (even though I hate it now!).

How can I add CSS or JavaScript to a JSF page and have it work?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
darkrain
  • 1,025
  • 4
  • 14
  • 23

3 Answers3

2

You can use the usual suspects: <script> and <style>. Depending on your JSF version, you may need to wrap them in a <f:verbatim> tag.

Michael Myers
  • 188,989
  • 46
  • 291
  • 292
Drew
  • 15,158
  • 17
  • 68
  • 77
2

Heres how I do it:

<f:view>
<html>
    <head>
        <link rel="stylesheet" href="./style.css" />
    </head>
    <body>
        <h:outputText value="Test style" style="background-color: red;" />
        <h:outputText value="Test style class" styleClass="testClass" />
    </body>
</html>
</f:view>
Chris Dale
  • 2,222
  • 2
  • 26
  • 39
-1

simply use :

   <h:head>
    <h:outputStylesheet library="css" name="css/style.css"  />
   </h:head>

for JS uses this tag :

 <h:outputScript> 
Moh Ali
  • 11
  • 1
  • Sorry, this won't work. OP clearly said he's using Woodstock. Your syntax works only from JSF 2.0 on. – BalusC Oct 21 '17 at 18:59