[
https://issues.apache.org/jira/browse/WW-3937?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13527688#comment-13527688
]
Daniel Woo edited comment on WW-3937 at 12/10/12 2:27 AM:
----------------------------------------------------------
Using parameters would work, but we probably need a naming convention, e.g, all
tiles attribute should be set as parameters with a prefix:
{code:java}
@Results(@Result(name = "test", location = "test", type ="tiles"
params = {
"tiles.attr.foo", "bar", // override a tiles attribute foo
"foo", "bar", // setting a request parameter foo
})
{code}
Then the TilesResult probably need a private HashMap to hold any parameters
with that prefix, pass that information to the BasicTilesContainer, so that the
method getAttributeContext() can populate overrided tiles attributes. I am not
an expert on tiles code and maybe you get a better idea to enhance this, what
do you think?
was (Author: danielywoo):
Using parameters would work, but we probably need a naming convention, e.g,
all tiles attribute should be set as parameters with a prefix:
<pre>
@Results(@Result(name = "test", location = "test", type ="tiles"
params = {
"tiles.attr.foo", "bar", // override a tiles attribute foo
"foo", "bar", // setting a request parameter foo
})
</pre>
Then the TilesResult probably need a private HashMap to hold any parameters
with that prefix, pass that information to the BasicTilesContainer, so that the
method getAttributeContext() can populate overrided tiles attributes. I am not
an expert on tiles code and maybe you get a better idea to enhance this, what
do you think?
> 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.x
>
>
> 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