• Register
0 votes

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?

7 5 2
3,870 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">
your javascript code here

Then everything worked perfectly as if nothing had happened!


Sometimes you will need below tag :


And not only below tag :


 Hope the above solutions help you in resolving your issue.

9 7 4
38,600 points

Related questions

0 votes
1 answer 192 views
Problem : I want to run the Eclipse JSF project on the Apache Tomcat on some other computer. I created the WAR file. But, when I try to deploy the WAR and open my Facelet page in Firefox, I usually face only the below error message: &ldquo;This XML file does not appear ... first time when I am trying to run the JSF app without my Eclipse. How is this issue popping up and how can I fix the issue?
asked Jan 3, 2020 alecxe 7.5k points
0 votes
1 answer 392 views
Problem : I have spent over the 10 hours in finding the exception or the special character to find in the code but I am unable to find it. I have already checked every similar messages in here. I am facing below error: Syntaxerror: json.parse: unexpected character at line 1 ... my form after that I am sending all the inputs to the main.js to validate it. So, I am just looking for the third-eye.
asked Dec 23, 2019 alecxe 7.5k points
0 votes
1 answer 309 views
Problem : I am trying to learn the pSQL. I recently moved my Laravel App from the MySQL to pSQL. But now I keep on getting below error. &ldquo;The Response content must be a string or object implementing __toString(), "boolean" given.&rdquo; I have the API that was returning my promotion before but now it only returns the above error. Can anyone suggest me solution on above error ?
asked Feb 13, 2020 mphil 2.3k points
0 votes
0 answers 9 views
What are the possible ways to target Html elements like (h1 ,p a,) tags with javascript file(App.js) Is there anyone who can guide me?
asked Nov 10, 2020 Han Li 710 points
0 votes
1 answer 23 views
I have to work with comparision between objects of two arrays this is actually my University Assignment someone please help me
asked Nov 10, 2020 Han Li 710 points
0 votes
1 answer 31 views
0 votes
1 answer 10 views
I need to know how to remove the first cgaracter of a string in Java.
asked Sep 25, 2020 Daniel Anderson 4k points
0 votes
1 answer 79 views
Problem: I am working on Fancybox for the very first time I am trying to display the inline content (it is a div with the image linked to the new page). My div and image are displayed properly in a modal but if a image is clicked to navigate to a new page then in that case I ... website.com/file/id:64/ext:.png" class="img" /></a></div></div> </li> Can someone help me in fixing my fancybox error.
asked Jul 14, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 40 views