You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Martin Cooper <ma...@tumbleweed.com> on 2002/09/18 01:48:47 UTC

[Tiles] getAsString only works once for a given value?

Here's one for the Tiles experts among you.

If I try to use the value of a 'put' twice using 'getAsString', the second
attempt causes an exception to be thrown. This doesn't sound right, so
either I'm doing something stupid, or it's a bug (or weird limitation?).

Here's my layout:

----- 8< -----
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:getAsString name="attr1"/>
<tiles:getAsString name="attr1"/>
----- 8< -----

And here's my page:

----- 8< -----
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>

<tiles:insert page="testLayout.jsp">
  <tiles:put name="attr1" value="My Attribute 1 Value"/>
  <tiles:put name="attr2" value="My Attribute 2 Value"/>
</tiles:insert>
----- 8< -----

Note that the layout uses 'attr1' twice. The first 'getAsString' tag works,
but the second (identical) one causes this:

----- 8< -----
[ServletException in:testLayout.jsp] Error - tag.getAsString : attribute
'null' not found in context. Check tag syntax'
----- 8< -----

If I change the second getAsString to refer to attr2, it works.

Anyone know what's going on, or better, know how I can get it to work?

TIA.

--
Martin Cooper


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