tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jamie Cockrill <jamie.cockr...@gmail.com>
Subject ViewPreparers and InsertAttributeTag
Date Mon, 14 Jun 2010 12:03:40 GMT
Dear All,

I fear I may have been a bit hasty and created a JIRA issue against
this already, for which I'm sorry. Retrospectively I thought it might
have been better to get in touch with the mailing list first. Firstly,
I am working with Tiles 2.2.1 and I am adding attributes to the
AttributeContext with a ViewPreparer as per the example at:


The line of interest is:

            new Attribute("This is the value added by the ViewPreparer"));

I am then attempting to access the attribute in the JSP, using the
tiles:insertAttribute tag like so:

<tiles:insertAttribute value="${some EL which returns
'my.attribute.name'}" flush="true" />

When I attempt to render the page, I receive a stack trace with the
following root cause:

java.lang.ClassCastException: java.lang.String cannot be cast to

The full stack itself is rather hard to retrieve as the system is on a
separate network. A simple test-case would be to create a simple
project with Tiles 2.2.1, a ViewPreparer that inserts an attribute
with a String value (as above) and a JSP that tries to insert that

The offending line of code seems to be the call to model.start in the
doTag, where the 'value' member is cast to an Attribute. It seems that
there doesn't appear to be any attempt to resolve the 'value' member
against the attribute-names in the attribute context.

Strangely, if I use "<tiles:useAttribute id="temp" name="${same EL as
above}" /> ${temp}" i get the content of the variable just fine.

I think the issue is either to do with the code being broken
(erroneous cast?) or the example being incorrect.

Thanks and apologies for the JIRA,


View raw message