将CSS或JS添加到Woodstock JSF页面

时间:2021-12-24 20:04:27

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

在我放弃之前,我试着让它工作超过2个小时。

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

需要使用JSF(伍德斯托克图书馆)(即使我现在讨厌它!)。

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

如何将CSS或JavaScript添加到JSF页面并使其工作?

3 个解决方案

#1


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.

您可以使用通常的嫌疑人:

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

#3


simply use :

只需使用:

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

for JS uses this tag :

for JS使用此标记:

 <h:outputScript> 

#1


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.

您可以使用通常的嫌疑人:

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

#3


simply use :

只需使用:

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

for JS uses this tag :

for JS使用此标记:

 <h:outputScript>