You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dominik Dorn <do...@dominikdorn.com> on 2015/03/18 17:09:34 UTC
How to use a property of render variables
Hi,
I couldn't find information on how to access properties of render
variables.
I have the following test case:
Suppose we have two classes:
class App { private String name; /* + getters/setters */ }
class Node { private List<App> apps; private String name; /* +
getters/setters */ }
in my page I have a
@Property private List<Node> nodes;
I try to do the following:
<t:loop source="nodes" value="var:node">
Server: ${var:node.name} :
<ul>
<t:loop source="var:node.apps" value="var:app">
<li>${var:app.name}</li>
</t:loop>
</ul>
</t:loop>
but somehow this does not work... If I create explizit iteration variables
for
node and app in my page-class, it works as expected.
Tapestry complains that it can't find the variable ${var:node.name} but
only ${var:node}, the same goes for ${var:app.name} / ${var:app} .. how can
I access a child property of a render variable?
Shouldn't this be working?
We're running Tapestry 5.3.7
Thanks,
Dominik
--
Dominik Dorn
http://dominikdorn.com | http://twitter.com/domdorn
XING: https://www.xing.com/profile/Dominik_Dorn
LINKEDIN: http://at.linkedin.com/pub/dominik-dorn/66/b42/bb1/
Re: How to use a property of render variables
Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
Render variables (a.k.a the var: binding) doesn't support properties.
Period. Instead, create a property in the corresponding Java class for
being your loop variable. The var: binding is only supposed to be used in
very specific scenarios in which the looped values are primitives, strings
or anything else you don't need to access properties.
On Wed, 18 Mar 2015 13:09:34 -0300, Dominik Dorn <do...@dominikdorn.com>
wrote:
> Hi,
Hi!
> I couldn't find information on how to access properties of render
> variables.
Because there's no way of doing that. ;) The var: binding is only supposed
to be used in very specific scenarios in which the looped values are
primitives, strings or anything else you don't need to access properties.
> If I create explizit iteration variables for node and app in my
> page-class, it works as expected.
That's your solution.
> Shouldn't this be working?
No. :)
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Fwd: How to use a property of render variables
Posted by Dominik Dorn <do...@gmail.com>.
Hi,
I couldn't find information on how to access properties of render
variables.
I have the following test case:
Suppose we have two classes:
class App { private String name; /* + getters/setters */ }
class Node { private List<App> apps; private String name; /* +
getters/setters */ }
in my page I have a
@Property private List<Node> nodes;
I try to do the following:
<t:loop source="nodes" value="var:node">
Server: ${var:node.name} :
<ul>
<t:loop source="var:node.apps" value="var:app">
<li>${var:app.name}</li>
</t:loop>
</ul>
</t:loop>
but somehow this does not work... If I create explizit iteration variables
for
node and app in my page-class, it works as expected.
Tapestry complains that it can't find the variable ${var:node.name} but
only ${var:node}, the same goes for ${var:app.name} / ${var:app} .. how can
I access a child property of a render variable?
Shouldn't this be working?
We're running Tapestry 5.3.7
Thanks,
Dominik
--
Dominik Dorn
http://dominikdorn.com | http://twitter.com/domdorn
XING: https://www.xing.com/profile/Dominik_Dorn
LINKEDIN: http://at.linkedin.com/pub/dominik-dorn/66/b42/bb1/