tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: JSTL <c:out> tag-- how to escape apostrophe
Date Thu, 13 Jul 2006 04:32:22 GMT
Quoting Chandra Avutu <cavutu@vmware.com>:

> I am using JSTL c:out tag to print server messages into HTML pages. However
> some of the messages contains apostrophe. Due to special chars the JSTL
> c:out
> tag was breaking. The following message from server breaks <c:out> tag.
> "Invalid datastore path 'No_Floppy.flp'." Is there any was I can fix this.
> Thanks, Chandra

I'm not sure why this isn't working for you, but here's an example to
demonstrate that escaping should be taking place. Try this page:

<%@ page contentType="text/plain" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="chars">& < > " '</c:set>
Escaped chars: <c:out value="${chars}"/>
Unescaped chars: <c:out value="${chars}" escapeXml="false"/>

The output should look like:

Escaped chars: &amp; &lt; &gt; &#034; &#039;
Unescaped chars: & < > " '

-- 
Kris Schneider <mailto:kris@dotech.com>
D.O.Tech       <http://www.dotech.com/>

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


Mime
View raw message