-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?

5
  • Which libraries are you using? Facelets? Richfaces? Tomahawk? Icefaces?... Please be a little more precise. Commented Jul 2, 2009 at 10:51
  • i am using the woodstock thing Commented Jul 2, 2009 at 11:32
  • Keep in mind the Woodstock library isn't being supported anymore. Commented Jul 2, 2009 at 13:31
  • "I have to use JSF . I hate it!" - Do you hate it just because you don't know how to do things with it (like embedding CSS)? Do you hate programming also? ;) Commented Jul 4, 2009 at 0:03
  • 2
    JSF is brilliant. Woodstock is a shame. Fortunately it's dead as of now. Commented Feb 1, 2011 at 20:21

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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>

Comments

-1

simply use :

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

for JS uses this tag :

 <h:outputScript> 

1 Comment

Sorry, this won't work. OP clearly said he's using Woodstock. Your syntax works only from JSF 2.0 on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.