[ 
https://issues.apache.org/jira/browse/WW-3937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13643535#comment-13643535
 ] 

Ken McWilliams commented on WW-3937:
------------------------------------

I don't think this is what tiles was meant to do. In the typical case.

This undermines one of the core features of tiles, that being it's central 
configuration (a single location where you can get an overarching view of 
well... the view). Tiles removes commonality of pages, but from the struts2 
perspective it should only be seen as a single view (like a single JSP). 

The answer on this page addresses this concern:  
http://stackoverflow.com/questions/16229352/whats-the-difference-between-tilesinserttemplate-and-tilesinsertdefinition/16248313#16248313

It also brings up tiles insertTemplate tag and insertDefinition tags, which I 
think are better a possible way to address this issue. That being creating 
result types for both these tiles tags and adding them to the tiles plugin.

The attributes of the tags themselves are easy to support as parameters but 
both of those tags allow for complicated nested structures which would be 
painful to support as parameters. Tiles API allows the construction of tiles 
objects. It would probably be easiest to simply require for such advanced 
functionality that the struts2 user construct a suitable tiles 
definition/template programmatically and supply it as the one and only 
parameter.

                
> The annotation @Result can have an extra attribute to hold tiles attributes
> ---------------------------------------------------------------------------
>
>                 Key: WW-3937
>                 URL: https://issues.apache.org/jira/browse/WW-3937
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Tiles
>    Affects Versions: 2.3.7
>            Reporter: Daniel Woo
>            Priority: Minor
>             Fix For: 2.3.15
>
>
> Currently the @Result annotation for tiles can only specify a location to 
> render, e.g.
> {code:java}
> @Action(value = "/home", results = {@Result(name = "success", location = 
> "home", type = "tiles")})
> {code}
> What I want is to add a new attribute like this:
> {code:java}
> @Action(value = "/home", results = {@Result(name = "success", location = 
> "home", tilesAttr={"loadcss", "/css/home.css"}, type = "tiles")})
> {code}
> The reason is to utilize wildcard tiles definition. Suppose we have the 
> wildcard tiles definition below,
> {code:xml}
> <definition name="*.*.*" extends="{3}-layout">
>     <put-attribute name="body" value="/view/{1}/{2}.jsp"/>
>     <put-attribute name="loadcss" value=""/>
> </definition>
> {code}
> The tiles attribute 'loadcss' should be set dynamically, or specified in the 
> annotation. Currently since the tiles plugin does not support the attribute 
> yet, we have to do that in the tiles configuration file with <put-attribute>, 
> that means we have to explicitly define each tiles definition without 
> wildcard support.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to