thanks for your answer. I am probably a bit slow here, because I can't really
figure out how to do it... ;-)
in my file layoutSearch.jsp, I have the following:
<tiles:definition id="message" page="/protected/pages/reportBody.jsp">
<logic:equal property="searchPlus30" name="searchForm" value="true">
<tiles:put name="???" type="string"/>
</logic:equal>
</tiles:definition>
<tiles:insert beanName="message" flush="true"/>
<tiles:insert page="/protected/pages/reportBody.jsp" flush="true">
<tiles:put name="showPlus30">
<tiles:insert name="message"/>
</tiles:put>
</tiles:insert>
and then in my reportBody.jsp, I have the following:
<tiles:insert name="showPlus30">
<tiles:put name="message">
<bean:message key="viewInitialReport.temp.plus30"/>
</tiles:put>
</tiles:insert>
I don't see what name my placeholder-<put> should have in my definition, and
how to use it? And the page for my definition?
Running this, I get the following exception:
2006-01-26 11:58:50,649 ERROR [ResourceFilter] Exception in resource
filter.javax.servlet.ServletException: ServletException in
'/unprotected/layouts/layout.jsp': ServletException in
'/unprotected/layouts/layoutSearch.jsp': ServletException in
'/protected/pages/reportBody.jsp': Can't insert page 'showPlus30' : Illegal to
flush within a custom tag
any idea is highly appreciated.
cheers,
pj
-----Opprinnelig melding-----
Fra: news [mailto:[EMAIL PROTECTED] På vegne av Laurie Harper
Sendt: 25. januar 2006 20:36
Til: [email protected]
Emne: Re: Tiles: how to put a tag without a closing tag?
Per Jørgen Walstrøm wrote:
> hello,
> I am trying to do a tiles:put on a tag without an ending-tag. Like this
> (layoutSearch.jsp):
>
> <tiles:put name="showPlus30Start" direct="true">
> <logic:equal property="searchPlus30" name="searchForm" value="true">
> </tiles:put>
>
> <tiles:put name="showTempEndTag" direct="true">
> </logic:equal>
> </tiles:put>
>
> these attributes are supposed to be used in a jsp like this:
>
> <tiles:insert attribute="showPlus30Start" ignore="true"/>
> <bean:message key="temperature.plus30"/>
> <tiles:insert attribute="showTempEndTag" ignore="true"/>
>
> The exception I get, looks like this:
> 2006-01-25 13:48:19,568 ERROR [ResourceFilter] Exception in resource filter.
> javax.servlet.ServletException: ServletException in
> '/unprotected/layouts/layout.jsp': ServletException in
> '/unprotected/layouts/layoutSearch.jsp':
> /unprotected/layouts/layoutSearch.jsp(15,4) The end tag "</tiles:put" is
> unbalanced
>
> This does apparently not work, as the <logic:equal> is not correctly ended in
> my <tiles:put>...
> is there a way to tell struts/tiles to get this to work?
No, not like that; as you've discovered, tags must be properly nested.
The right way to do this is to define a tile with both the logic:equal
start tag and end tag, wrapped around a placeholder. Something like
(very roughly)
<tiles:put name="showPlus30">
<tiles:insert name="message"/>
</tiles:put>
...
<tiles:insert name="showPlus30">
<tiles:put name="message">
<bean:message .../>
</tiles:put>
</tiles:insert>
I don't use the Tiles taglib (I do everything through tiles-defs.xml) so
that markup is probably way off, but hopefully you get the idea...
L.
---------------------------------------------------------------------
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]