You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by James Watkin <ja...@anderson.ucla.edu> on 2004/01/23 23:47:00 UTC

Tag to Unescape an HTML String?

I have a question regarding the following problem and proposed solution: 
Within a JSP, what would be the most efficient way to unescape an HTML 
string? The Regexp tag library? I've managed to avoid writing regular 
expressions for a long time.

Problem:
I'm creating some reusable JSP templates that are chained together with 
<c:import>. I'm trying to solve the well known problem of having to create 
two new JSPs for every new page -- one for the new page body, the other to 
import the master page layout and pass the URL of the new page body JSP.

Proposed Solution:
Rather than pass the master page layout a URL for the body JSP, I can 
eliminate the body JSP by passing in the body as a String. If my master 
page layout is within the same container, then I can use <c:set> and not 
have to worry about unescaping the body String. However, I'd prefer (I 
think) to have the master page layout live outside the container, 
especially since the JSTL spec notes that foreign context access within the 
same container might not be supported by all containers. If the master page 
layout JSP is outside the container of the importing JSP, then the body 
HTML String has to be passed with <c:param>, which escapes the string. So 
I'll need to unescape it be I can use it.

- Jim

______________________________
James Watkin
ACIS Software Development
The Anderson School at UCLA
james.watkin@anderson.ucla.edu
Voice: 1-310-825-5030
   Fax: 1-310-825-4835
______________________________ 


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