You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Axel Gross <ka...@iaeste.at> on 2004/03/14 21:47:57 UTC

[Q] tiles: defining jsp fragments in a jsp

what i got here is very special layout code which I reuse inside of one jsp and i don't
want to remove it from there, because no other jsp would need it.
so it would be quite stupid to separate them.

i'm trying to achieve this functionality with tiles
(so in my case it's a .printMessages tile which should use a .printMessage
definition ). If anybody has another suggestion, please tell me.

i think i have some problems concerning attributes and scope; it works if i extract the
definition into a separated jsp file and use that instead of .direct
struts 1.1; jsp2.0; tomcat 5.0
so what didn't work was like (now in a concentrated form):

 * the jsp of .direct

<@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"
<tiles:importAttribute />
<tiles:insert attribute="contents" />


 * the jsp of .printMessages

<@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"
...
<tiles:definition id=".printMessage" extends=".direct">
    <tiles:put name"contents" type="string">
<%-- can't find this: <tiles:useAttribute name="putmsg" ignore="false" />
--%>
        <td>${putmsg}</td>
    </tiles:put>
</tiles:definition>

...
<html:messages id="msg" name="myProperty">
    <tiles:insert flush="false" name=".printMessage">
        <tiles:put name="putmsg" value="${msg}" type="string" />
    </tiles:insert>
</html:messages>
...
	

regards,
axel

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