[ 
https://issues.apache.org/jira/browse/TILES-511?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Antonio Petrelli closed TILES-511.
----------------------------------

    Fix Version/s:     (was: 2.2.x)
       Resolution: Not A Problem

Solved here:
http://tiles.markmail.org/message/o3dybr642jajqryk?q=+list:org%2Eapache%2Etiles%2Eusers&page=1

> InsertAttributeTag throws ClassCastException on attribute added through 
> ViewPreparer
> ------------------------------------------------------------------------------------
>
>                 Key: TILES-511
>                 URL: https://issues.apache.org/jira/browse/TILES-511
>             Project: Tiles
>          Issue Type: Bug
>          Components: tiles-jsp (jsp support)
>    Affects Versions: 2.2.1
>         Environment: Tomcat 6.0.24 on Ubuntu
>            Reporter: James Cockrill
>
> I am adding attributes to the AttributeContext with a ViewPreparer as per the 
> example at:
> http://tiles.apache.org/framework/tutorial/advanced/preparer.html
> The line of interest is:
>         attributeContext.putAttribute(
>             "my.attribute.name",
>             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="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 
> org.apache.tiles.Attribute
>     
> org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:306)
> 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 attribute. 
> 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="my.attribute.name" 
> /> ${temp}" i get the content of the variable just fine.
> The issue is either to do with the code being broken (erroneous cast?) or the 
> example being incorrect.
> Thanks

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to