Hi,
I have never tested the limit for the bodyContent of a <put> tag. Internally, it is
transformed to a String, but I don't thing there is a limit to it. The problem can be
a memory one : I think the String is allocated each time you parse the tag ! I am not
sure that it is more memory/time consuming than an include
of another jsp. Need some tests here.
To reduce memory consumption, you can try to declare the body as a static string,
and put it in tag as a scriptlet (<put name="header" value="<%=myBody%>" type="string"
/>). I have never try it, and I am not sure that it is better than using directly the
body.
Personally, when the content is too big, I prefer to put it in a separate file. I
use bodyContent only for small content.
Be care : you can't do <insert> in the body of <put>, because it is a bodyTag ;-(.
Cedric
Peter Pilgrim wrote:
> In the Struts Template in order to use dynamic layout features
>
> introduction.jsp
> <%@ taglib uri='/WEB-INF/struts-template.tld' prefix='template' %>
>
> <template:insert template='/chapterTemplate.jsp'>
> <template:put name='title' content='Templates' direct='true'/>
> <template:put name='header' content='/header.html' />
> <template:put name='sidebar' content='/sidebar.jsp' />
> <template:put name='content' content='/introduction.html'/>
> <template:put name='footer' content='/footer.html' />
> </template:insert>
>
> underConstruction.jsp
> <%@ taglib uri='/WEB-INF/struts-template.tld'
> prefix='template' %>
>
> <template:insert template='/chapterTemplate.jsp'>
> <template:put name='title' content='Templates' direct='true'/>
> <template:put name='header' content='/header.html' />
> <template:put name='sidebar' content='/sidebar.jsp' />
> <template:put name='content' content='/underConstruction.html'/>
> <template:put name='footer' content='/footer.html' />
> </template:insert>
>
> This is tiredsome because for every JSP file you need to have
> a separate insert file just to use the template.
>
> In Tiles you use a different form which very direct
>
> <template:insert template="layout.jsp">
> <template:put name="title" value="Test with a tag body" />
> <template:put name="header" type="string">
> <strong>This header is inserted as body of tag</strong>
> </template:put>
> <template:put name="body" value="body.jsp"/>
> </template:insert>
>
> My question is how big can the BodyContent of the <template:put>
> string form be? I would like place a lot of the content in this
> custom tag? I am wondering if this is good idea or if there is a pitfall
> in performance or memory Cedric?
>
> --
> Peter Pilgrim | | ++44 (0)207-545-9923
> .... \ \ ___ / / ... .
> - ---- ( * ) --- --
> _____________________________Cafe_Savannah,_San Antonio,Ibiza__
>
> --
>
> This e-mail may contain confidential and/or privileged information. If you are not
>the intended recipient (or have received this e-mail in error) please notify the
>sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or
>distribution of the material in this e-mail is strictly forbidden.