I'm using Java Facelets and jQuery, however the expression
$('...')
in jQuery conflicts with EL expression, how do I escape the jQuery's one?
I'd like to escape a large chunk of Javascript, too.
ANSWERED
To convert the existing JSP to Facelets xhtml, it's convenient to just wrap the existing javascript by <![CDATA[ ... ]]>
. However, the output scripts for <script>
are wrapped by <!-- -->
comment, which conflicts with CDATA section:
<script><![CDATA[ scripts... ]]></script>
=> <script><!-- <![CDATA[ scripts... ]]> --></script>
To resolve this problem, you should also comment out the CDATA:
<script>/* <![CDATA[ */ scripts... /* ]]> */</script>
=> <script><!-- /* <![CDATA[ */ scripts... /* ]]> */--></script>
See also When is a CDATA section necessary within a script tag?.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…