tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yansheng Lin" <>
Subject RE: <jsp:include/> within a while loop [problems]
Date Wed, 25 Feb 2004 17:14:01 GMT
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 [] 
Sent: Wednesday, February 25, 2004 10:05 AM
Subject: <jsp:include/> within a while loop [problems]


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

---Snippet from Persons.jsp---

<jsp:useBean id="persons" class="Collection" scope="request"/>
Iterator iter = persons.iterator();
while( iter.hasNext() ) {
    request.setAttribute( "person", (PersonBean) );
<!-- 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) );
<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... -->

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.

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message