tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Bayern <>
Subject Re: Quoting problem
Date Tue, 06 Aug 2002 13:45:54 GMT
On Tue, 6 Aug 2002 wrote:

> I'm trying only to write a link's target if it actually exists or is
> different than "_self". This is my code:
> <%-- Save the link target window if necessary --%>
> <c:choose>
>   <c:when test="${( == null) || ( == '') ||
> ( == '_self')}">
>     <c:set var="target" value=""/>
>   </c:when>
>   <c:otherwise>
>     <c:set var="target" value=' target="${}"'/>
>   </c:otherwise>
> </c:choose>
> Unfortunately, in my link below which reads
> <a href="<c:out value="${link.url}"/>"<c:out value="${target}"/>>
> I get the following result when the page is created:
> <a href="" target=&#034;_blank&#034;>
> How can this be escaped when I don't use escapeXml?

Why not use escapeXml?  Your intent is to print XML metacharacters (the
quotation mark has special syntactic meaning to XML), so it seems to make
sense to set escapeXml="false" in the latter "target" tag.

The other option, in this specific case, is to make "target" more
specific.  Does the browser behave the way you want it to behave it a tag
looks like

  <a href="http://foo" target="">

If so, then you could set the 'target' variable only to the *value* of the
'target' attribute and then write

  target="<c:out value="${target}" />"

Hope that helps,

Shawn Bayern
"JSTL in Action"

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message