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

Reply via email to