• Register
0 votes
56 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?

7 5 2
3,870 points

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.

9 7 4
38,600 points

Related questions

0 votes
1 answer 133 views
133 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 alecxe 7.5k points
0 votes
1 answer 269 views
269 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 7 views
7 views
I need to know how to remove the first cgaracter of a string in Java.
asked Sep 25 Daniel Anderson 4k points