Thank you Yansheng.

I have increased the page buffer to 32KB, and was still experiencing the same problem. 
In order to fix it, I had to add this as the last line in the JSP:

<%out.flush();%>

I don't know why that is, but this seems to have solved the problem. Apologies for 
this not being a Tomcat related post, I figured this was a good place to post it since 
we weren't experiencing this problem with Resin.

Thanks again!



-----Original Message-----
From: Yansheng Lin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 25, 2004 9:14 AM
To: 'Tomcat Users List'
Subject: RE: <jsp:include/> within a while loop [problems]


You are overflowing the default page buffer with the include statement.  Try to
set auto flush to be false(since the default with flush when buffer is close to
its limit), or increase the page size to something like <% @page buffer= "32k"
%>

Hope that helps.  Btw, not tomcat related topic:).

-----Original Message-----
From: Daniel Wintschel [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 25, 2004 10:05 AM
To: [EMAIL PROTECTED]
Subject: <jsp:include/> within a while loop [problems]


Hello,

I have been having some problems debugging a set of three JSPs that use
<jsp:include page=""/> tags within a while loop in Tomcat 4.1.29.

Just so I don't send my actual code to the list, I will create an identical
example using Persons.jsp, Person.jsp, and PhoneNumber.jsp to demonstrate my
problem.

---Snippet from Persons.jsp---

<jsp:useBean id="persons" class="Collection" scope="request"/>
<%
Iterator iter = persons.iterator();
while( iter.hasNext() ) {
    request.setAttribute( "person", (PersonBean)iter.next() );
%>
<!-- Display people -->
      <jsp:include page="Person.jsp"/>
<%
}
%>

---Snippet from Person.jsp---

<jsp:useBean id="person" class="my.package.PersonBean" scope="request"/>
<%
Iterator phone = person.getPhoneNumbers();
while( phone.hasNext() ) {
    request.setAttribute( "phone", (PhoneBean)phone.next() );
%>
<jsp:include page="PhoneNumber.jsp"/>
<%
}
%>

---Snippet from PhoneNumber.jsp---

<jsp:useBean id="phone" class="my.package.PhoneBean" scope="request"/>
<span class="somecss">
<jsp:getProperty name="phone" property="phoneNumber"/>
<!-- ...other attributes and html gunk... -->
</span>


-------
Now.... What happens is, when I make a request to the main page "Persons.jsp",
no exceptions are thrown, and the page begins to render correctly. But what
happens is the content is cut off at some random point during the iteration of
people/phone numbers. It differs every time you request the page, and from
viewing the source, it is clear that the output stream has just been closed at
some random point while writing the response.

I haven't been able to find any other postings like this describing any such
similar problems, and at this point, I am unaware of any way to fix this problem
except by rewriting the pages to not use the <jsp:include> tags within the while
loop. I know that this exact same thing works under Caucho Resin 2.1, and only
since we ported to Tomcat have we started to see this problem.

Any information or insight would be greatly appreciated.
Thanks!



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to