Smarty allows to access object properties using this syntax in templates:
{$object->property}
But (If I understood this correctly) this is possible only if property visibility is public
, otherwise it seems that Smarty won't be able to access it.
In Java I'm used to create objects that have private properties, and I usually read/write these properties in business logic using getters and setters. But, even if I create an object with a private property, I'm able to access it in a jsp using expression language:
${object.property}
This won't happen in Smarty templates, since private properties cannot be accessed this way. So I would have to use a syntax like:
{$object->getProperty()}
Why is that? Why doesn't Smarty get round the problem as jsp
EL does?