javahtmlxmlcdata

Alternative to CDATA for HTML


I want to display strings like & in an HTML page, but it is rendered as &. Is there any possibility to tell the browser to display text without processing, something like CDATA in XML.

PS. On the server side I am using Java.


Solution

  • No, those characters are designed specially to be displayed this way. You can instead send & which will display as you wish. Depending on what server side language you use there is likely to be an HTMLEncode function which will do this for you.

    PS - PRE & CODE do not work for HTML symbols.