Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: Release 1.4.3
-
Fix Version/s: Release 1.5.4
-
Component/s: Tag Library
-
Labels:None
Description
I'm using the Stripes layout tag library and am experiencing difficulties rendering huge web pages.
An example structure is the following (/WEB-INF/jsp/content.jsp file generates approximately 13 megabytes of data)
<%@ taglib uri="http://stripes.sourceforge.net/stripes.tld" prefix="stripes" %>
<stripes:layout-render name="/WEB-INF/jsp/layout.jsp">
<stripes:layout-component name="body-content">
<!-- either this -->
<stripes:layout-render name="/WEB-INF/jsp/content.jsp"/>
<!-- or this -->
<jsp:include page="/WEB-INF/jsp/content.jsp" flush="true"/>
</stripes:layout-component>
</stripes:layout-render>
This results in OutOfMemory errors being thrown (and page not being displayed), the server has 512MB of heap space available.
Changing the code in LayoutRenderTag.java from
BodyContent content = getPageContext().pushBody();
getPageContext().include(this.name, false);
getPageContext().popBody();
getPageContext().getOut().write(content.getString());
to
getPageContext().include(this.name, false);
I am able to render the large jsp files inside the layout-render tags.
Could this somehow be fixed ? Could you consider adding an additional attribute to the layout-render tag that would work without loading the whole contents of the inserted subpage into a buffer ?
The code change I had posted above is probably rubbish and doesn't help much (if at all).
Still it would be cool to have the opportunity to use layouts with large subcomponents.The Tiles 2 project is better at doing this, the putAttribute http://tiles.apache.org/framework/tiles-jsp/tlddoc/tiles/putAttribute.html tag, which is meant to assign content to be rendered to a template/layout, accepts nested content like <stripes:layout-component> tag does but can also render another template/jsp like this
<tiles:putAttribute name="body-content" type="template" value="template.jsp"/>
which happens to be less memory hungry.