Erik Beijnoff wrote:
When you are using the jsp document (xml) syntax, is it possible to pass in
an xml fragment as a parameter to <c:import> and then reference the
parameter as xml and not escaped text?

Import statement:
<c:import url="/WEB-INF/jspf/main.jsp">
...
<c:param name="body">
<p class="leadtext">A text</p>
</c:param>
...
</c:import>

Referenced file:
<?xml version="1.0" encoding="UTF-8"?>
<jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page";
xmlns:c="http://java.sun.com/jstl/core";
version="1.2">
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
...
<div>
<c:out value="${param.body}"/>
</div>
...
</jsp:root>

Unfortunately the text that gets output in c:out is escaped text and not
xml: "&lt;p class="leadtext"&gt;A text&lt;/p&gt;"
and not
"<p class="leadtext">A text</p>"

Is there a way to do it? And if not, is there another suitable solution?

Use the escapeXml attribute:


<c:out value="${param.body}" escapeXml="false" />

Hans
--
Hans Bergsten                                <[EMAIL PROTECTED]>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com

Reply via email to