Adding CSS or JS to Woodstock JSF page

ぐ巨炮叔叔 提交于 2019-12-13 09:48:53

问题


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?


回答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 :

 <h:outputScript> 


来源:https://stackoverflow.com/questions/1073663/adding-css-or-js-to-woodstock-jsf-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!