You can point external js or css file, as shown bellow:
<af:document>
<af:resource type="javascript" source="/js/MyJsCode.js"/>
...
</af:document>
or insert javascript / css code inside tag body:
<af:document>
<af:resource type="javascript">
function myJavascriptFunction(){
alert('This is my function');
}
</af:resource>
...
</af:document>
The parent of a af:resource component should be af:document. There is not recommended use of af:resource inside other adf component.
Another way of adding scripts/css to ADF page is "standard" JSF way:
<af:document>
...
<f:facet>
<script type="text/javascript">
function myJavascriptFunction(){
alert('This is my function');
}
</script>
</f:facet>
...
</af:document>
If you need put CSS into <f:facet> you can encounter problems when compiling. To avoid simillar problems you can wrap tags <style></style> section <![CDATA[ ]]>.