• Register
0 votes
180 views

Problem :

I want to insert Javascript to the <h:commandButton />'s onclick property as the action is already rendering the ajax table.

What I want to do is to get a selected items in the list box and turn them into the parameters to be used in the JSF FileServlet. i.e. para2=value1&param=value2&param=value3

What I get when the page is loaded as below:

javax.servlet.ServletException: Error Parsing /page.xhtml: Error Traced[line:15] The content of elements must consist of well-formed character data or markup.

As soon as I add the for (var i = 0; i < length; i++) or even the for (var i = 0; i < 10; i++) my page wouldn't load. How can I fix my for loop issue?

3.9k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I ran across your post today as I was running into a same issue and had a same problem of a javascript not running with a CDATA tags listed above. I corrected my CDATA tags to look like as below :

<script type="text/javascript">
//<![CDATA[ 
your javascript code here
//]]>
</script>

Then everything worked perfectly as if nothing had happened!

OR

Sometimes you will need below tag :

/*<![CDATA[*/
 /*]]>*/

And not only below tag :

 <![CDATA[
 ]]>

 Hope the above solutions help you in resolving your issue.

38.6k points