commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Libbrecht <p...@activemath.org>
Subject Re: [Jelly] Retrieving properties of Java beans in scripts
Date Wed, 20 Sep 2006 07:44:35 GMT
Ray,

In principle all this is delegated to Jexl which delegates this to 
beanutils. I think your expectation is correct but there may either a 
half-correct usage of beanutils or a half-bean-conformance in your 
objects. Have you tried to make it using method calls (which is all it 
boils down to at the end) ?
  ${order.getCustomer().getName()}

paul

Ray Shi wrote:
> Hi there,
>
> In the Java code, if I creat an Order bean instancen, and set it to the
> variable 'order' in the Jelly context as showed in the folllowing code
> snippet,
> …
> myJellyContext.setVariable("order", order);
> …
> myScript.run(myJellyContext, output);
> ...
>
> Then in the Jelly script, I would expect the jelly:core expr element 
> <j:expr
> value='${order.customer.name}'/> would return "Bob Smith" which is the 
> value
> of the nested 'name' property.
>
> However with the current Jelly implementation, it returns a null value.
>
> So how do I access the properties of Java beans added into the Jelly 
> context
> from within the Jelly scripts?
>
>
> Thanks in advance
> Ray
>



Mime
View raw message