On 8/22/05, David Haynes <[EMAIL PROTECTED]> wrote:

> >
> Sorry to hi-jack this thread a bit, but I am confused. Can't the getter
> methods be enhanced to call the data population methods to do what Rick
> wants? By that I mean something like getList()  containing a List which
> is populated by a call to, say, populateList(). Sort of:
> 
> public List getList() {
>     List list = populateList();
>     return list;
> }
> 
> The getList would be invoked during the jsp:useBean wouldn't it?
> 
> I'm probably missing something obvious here, but this seems so much simpler.
> 

This would work (although you'd probably want to do some sort of
in-request caching so you don't call populateList() more than once),
but I tend to shy away from making getter and setter methods for
properties have side effects like this.  It's much clearer (well, to
me anyway :-) when pulling data from the model is explictly called out
in its own methods.

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to