You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andreas Schyman <an...@ctrl-ps.com> on 2002/08/01 13:22:20 UTC

Feeding tiles:insert with bean:write?

Hi!

I'm trying to create a tiles-layout that will iterate over a putList
and insert each item as a tile, much as in the provided example
vboxLayout.jsp found in tiles-documentation.war. However, while that
example uses a java.util.Iterator to do this, I want to populate a
bean and iterate over it using logic:iterate, and this works fine,
but I can't feed the bean:write to tiles:insert. Can't I do this?


My template looks like this:
--------------------------------------------------------------------
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles" %>

<tiles:importAttribute scope="page"/>

<logic:iterate id="module"
               name="modules"
               type="org.apache.struts.tiles.beans.MenuItem"
               scope="page">
<%-- This does not work --%>
	<tiles:insert name="<bean:write name="module"
                                       property="value"/>"/>
<%-- This works 
	<bean:write name="module" property="value"/>
--%>
</logic:iterate>
--------------------------------------------------------------------


When I run it with tiles:insert active, I get the following error:
--------------------------------------------------------------------
[ServletException in:/WEB-INF/jsp/layouts/moduleLayout.jsp]
/WEB-INF/jsp/layouts/moduleLayout.jsp(10,45) Attribute module has
no value'
--------------------------------------------------------------------


If this isn't possible, I guess I could use java.util.Iterator, but
I want to keep the tamplate as clean from java as possible.

Best regards,
Andreas

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>