Rocchi Cesare wrote:
Hiall,
I have defined a Restaurant class like this:
public class Restaurant { public String name = ""; public String address = ""; }
As you can see fields are public, but as far as I tried I can't access those fields from a velocity context. If I put the rest in a context like:
Restaurant r = new Restaurant(); r.name = "test"; r.address = "bla bla "; context.put("rest", r);
there is no way to get the value of address by means of
$rest.address
I guess there was some config to enable/disable that, but I'm not sure ?
I thought it was possible. Is it? Otherwise I should convert my class into an hashtable. That works, already tried.
You could also define public getter methods, named getAddress(), getName() Then you should be able to access $rest.address
Thanks,
-c.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
