Wednesday, 22 October 2014

How to load external javascript or css files in jsff?

Guys, if you want to use external javascript or css, you can use af:resource tag in jsff page.
<source>
  <af:resource source="/customStyles.css" type="css"></af:resource>
</source>
In-line CSS content:
<source>
  <af:resource type="css">
    DIV.customStyle { color: red; }
  </af:resource>
</source>
Include an external JS file:
<source><  af:resource source="/customCode.js" type="javascript"></af:resource></source>
In-line JavaScript code:
<source>
  <af:resource type="javascript">
    function clientListenerFunction(event)
    {
       // content ...
    }
  </af:resource>
</source>

No comments: