Who tried to use an if with javascript with logic operators && or ||, knows how painful this can be inside a JSF page.

Many developer opt to create .js files and reference them with tag <script src=”path_to_file.js”></script>, what is highly recommended, but will increase amount files in your directories when you just need a specific script only in a page and in no other place.

To avoid fails in JSF Render Fase, add a comment followed by tag CDATA after line with <script> and end with another comment closing CDATA, like this:

<script>
//<![CDATA[
...
//]]>
</script>

JSF works parsing these files as XML and the expressions “&&” and “||” are confused with scriptlet’s logic operators or ELExpressions, what causes fail in rendering.