You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/05/12 23:42:26 UTC

DO NOT REPLY [Bug 19872] New: - CDATA section causes syntax error using

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19872>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19872

CDATA section causes syntax error using <html:javascript>

           Summary: CDATA section causes syntax error using
                    <html:javascript>
           Product: Struts
           Version: 1.1 RC1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Custom Tags
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: richard.hunt@solnet.co.nz


I'm trying to ensure some JSP pages I am writing generate XHTML compliant code 
and am encountering problems using the <html:javascript> tag.  This tag 
generates the following HTML output:

<script type="text/javascript"> 
<![CDATA[
     
     (Generated Javascript Here....)

]]>
</script>

When IE5 attempts to parse this page it picks up the begin and end of the CDATA 
section as syntax errors in the javascript code (and thus doesn't execute any 
of the javascript).  I can't resolve this by just setting the cdata attribute 
of the javascript tag to false as I need the CDATA section to prevent 
processing of any special XML characters in the javascript code.

What I would prefer is for the CDATA section to be generated with javascript 
comments as follows:

<script type="text/javascript"> 
//<![CDATA[
     
     (Generated Javascript Here....)

//]]>
</script>

The CDATA section will now no longer cause javascript errors but will still be 
picked up by any XML processing as appropriate, although I must admit I'm not 
really familiar enough with the whole HTML/XML/XHTML area to know whether this 
will cause any other problems.

I've had a look at the code for the JavascriptValidatorTag and this seems like 
it would be a fairly trivial change to make.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org