Hi,
I'm trying to use a tile insert with dynamic attributes passed into the
tile from a model. These values were passed into the current tile and
I'm passing it to the child tile. I am trying to insert with the
tiles:put tag (struts-tiles.tld" prefix="tiles") with EL expression for
names and values.
The following is the code in my current tile
...
<tiles:insert definition="${SiteFeatureModel.tile}" >
<c:forEach items="${SiteFeatureModel.tileAttributes}"
var="currentAttribute">
<tiles:put name="${currentAttribute}"
beanName="${currentAttribute}" />
</c:forEach>
</tiles:insert>
...
In my controller I copy the attribute names passed into the current tile
and set the model value of tileAttributes to that as shown below.
...
Vector tileAttributes = new Vector();
for (Iterator i=componentContext.getAttributeNames(); i.hasNext();){
tileAttributes.add(((String)i.next()));
}
...
The above code in JSP doesn't work saying that the attribute I'm passing
in the put is not found in the child tile's context.
But if I put a static string in the name attribute it works fine. Let us
say it has a name - CHILDATTRIBUTENAME
This works (although it doesn't help with what I'm trying to do)
<tiles:insert definition="${SiteFeatureModel.tile}" >
<c:forEach items="${SiteFeatureModel.tileAttributes}"
var="currentAttribute">
<tiles:put name="CHILDATTRIBUTENAME"
beanName="${currentAttribute}" />
</c:forEach>
</tiles:insert>
Question is - the JSR spec says EL can be used on tag attributes but the
tag put's name attribute doesn't seem to allow this, unless I'm missing
something.
Can you suggest a workaround or details on what I'm missing above?
Thanks,
Anup Chatterjee
Software Engineer
MarketLive, Inc
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]