Adding CSS or JS to Woodstock JSF page

2019-10-07 16:38发布

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?

3条回答
Lonely孤独者°
2楼-- · 2019-10-07 17:30

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.

查看更多
兄弟一词,经得起流年.
3楼-- · 2019-10-07 17:33

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>
查看更多
Deceive 欺骗
4楼-- · 2019-10-07 17:41

simply use :

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

for JS uses this tag :

 <h:outputScript> 
查看更多
登录 后发表回答