views:

410

answers:

0

Trying to use JSPX and running into a strange problem. Text inside jsp:text is supposed to not be subject to whitespace removal, according to the JSP documentation, but when I have a jsp:text element with leading whitespace in the beginning of a tagx file, when used in the jspx views, the leading whitespace disappears.

I've done quite a bit of Googling but can't find what's causing this to be removed. I've verified that the same jsp:text instances included directly in the jspx view work correctly, but put into a separate tagx file causes it to be lost.

This is under Jetty 6.1.19 and 6.1.22 using JSP 2.1 libraries.

EDIT: Some sample code follows. Note that the spaces leading and trailing within the <jsp:text> tags are stripped. Judging by the JSP documentation I can see, whitespace within those should be retained.

WEB-INF/tabs/nameValuePair.tagx:

<jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page"&gt;
<jsp:directive.attribute name="name" type="java.lang.String" required="true"/>
<jsp:directive.attribute name="value" type="java.lang.String" required="true"/>
<jsp:text> ${name}=${value} </jsp:text>
</jsp:root>

test.jspx:

<jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:t="urn:jsptagdir:/WEB-INF/tags">
<jsp:directive.page contentType="text/html; charset=ISO-8859-1" />

<html>
    <head>
        <title>Test</title>
    </head>
    <body>
        <t:nameValuePair name="name" value="Google" />
        <t:nameValuePair name="age" value="11" />
        <t:nameValuePair name="description" value="Popular Search Engine" />
        <jsp:text> test=value </jsp:text>
    </body>
</html>

</jsp:root>

output:

<html><head><title>Test</title></head><body>name=Googleage=11description=Popular Search Engine test=value </body></html>