I\'m facing some problems using CDATA blocks inside h:outputscripts with MyFaces 2.0... but I don\'t know exactly if I should avoid using CDATA with JSF2 or if it is because I d
I can't answer if you're the only one having problems with it. I can at least answer that having JS code plain in a XML file is a poor practice. JS code is not well formed XML. Fiddling with escaping XML-special characters in JS code or putting JS code in CDATA blocks is plain ugly. That it gives troubles in JSF ajax response is in turn a different story. Technically, that would have been a bug in the JSF implementation used. But from the other side on, you're actually practicing a poor practice.
Just put JS code in its own .js
file which you reference by <h:outputScript>
.
<cc:implementation>
<h:outputScript library="foo" name="js/your-cc-script.js" target="head" />
...
</cc:implementation>
This is a known issue. See MYFACES-3339 for details. It was already fixed, so you can try the latest code HERE, and it will be included on 2.1.4 and 2.0.10.