tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yansheng Lin" <yansheng....@silvacom.com>
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 [mailto:dwintschel@esportz.com] 
Sent: Wednesday, February 25, 2004 10:05 AM
To: tomcat-user@jakarta.apache.org
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message