Here is the link to an article on SDN on trimDirectiveWhitespaces:
http://java.sun.com/developer/technicalArticles/J2EE/jsp_21/

Please be aware that with trimDirectiveWhitespaces enabled, all
whitespaces between two JSP tag are removed.  So something like:

<c:out value="Hello"/> <c:out value="World"/>

will output:

HelloWorld

instead of:

Hello World


Bill

On 5/8/07, Scott Ferguson <[EMAIL PROTECTED]> wrote:
>
> On May 8, 2007, at 9:51 AM, Aaron Freeman wrote:
>
> > Can anybody provide me with any links/hints on this?
>
> JSP 2.1 has a trimDirectiveWhitespace option for the <%@ page %>
> tag.  That would be the cleanest way to remove the extra whitespace.
>
> -- Scott
>
> >
> > Thanks,
> >
> > Aaron
> >
> >
> >> -----Original Message-----
> >> From: [EMAIL PROTECTED]
> >> [mailto:[EMAIL PROTECTED] On Behalf Of Aaron Freeman
> >> Sent: Thursday, May 03, 2007 10:59 AM
> >> To: resin-interest@caucho.com
> >> Subject: [Resin-interest] XML View Question
> >>
> >> We have a controller JSP that looks like this:
> >>
> >> ------------ Begin Controller ------------ <%@ taglib
> >> uri="http://java.sun.com/jsp/jstl/core"; prefix="c" %> <%@
> >> taglib uri="http://java.sun.com/jsp/jstl/functions"; prefix="fn" %>
> >>
> >> <c:catch var="exception">
> >>
> >>     ... do some logic ....
> >>
> >> </c:catch>
> >>
> >> <c:choose>
> >> <c:when test="${empty exception && param.o == 'xml'}">
> >>    <jsp:include page="/xml/_view.jsp"/>
> >> </c:when>
> >> <c:when test="${empty exception}">
> >>    <jsp:include page="/html/_view.jsp"/> </c:when>
> >> <%-- An exception occured. --%>
> >> <c:when test="${param.o == 'xml'}">
> >>    <jsp:include page="/xml/_error_view.jsp"/> </c:when> <c:otherwise>
> >>    <jsp:include page="/html/_error_view.jsp"/> </c:otherwise>
> >>
> >> </c:choose>
> >> ------------ End Controller ------------
> >>
> >> Then our xml/_view.jsp would look something like this:
> >>
> >> ------------ Begin xml/_view.jsp ------------ <jsp:root
> >> version="2.0">
> >>
> >> <jsp:directive.taglib uri="http://java.sun.com/jsp/jstl/core";
> >> prefix="c" />
> >>
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <result>
> >>     <c:forEach ...>
> >>
> >>         ... output some XML tags ....
> >>
> >>     </c:forEach>
> >> </result>
> >>
> >> </jsp:root>
> >> ------------ End xml/_view.jsp ------------
> >>
> >> The problem is sometimes the end result has a bunch of white
> >> space at the beginning of the document and sometimes the
> >> <c:forEach> generates lots of linefeeds which cause XML
> >> parsers to fail.  What is the proper way to dump an XML view
> >> such that there are no linefeeds in between the XML tags and
> >> there isn't a lot of whitespace above the XML?
> >>
> >> Thanks,
> >>
> >> Aaron
> >>
> >>
> >>
> >> _______________________________________________
> >> resin-interest mailing list
> >> resin-interest@caucho.com
> >> http://maillist.caucho.com/mailman/listinfo/resin-interest
> >>
> >
> >
> >
> > _______________________________________________
> > resin-interest mailing list
> > resin-interest@caucho.com
> > http://maillist.caucho.com/mailman/listinfo/resin-interest
>
>
>
> _______________________________________________
> resin-interest mailing list
> resin-interest@caucho.com
> http://maillist.caucho.com/mailman/listinfo/resin-interest
>


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to