piero de salvia wrote:
> Do I put People and Beers in EVERY request? page2
> won't use People and page1 won't use Beers. This is no
> big deal for 2 business objects, but what about 2000?
> Maybe it's still acceptable, I don't know, this is
> totally new to me.
> 1.how do I do the partitioning without modifying the
> controller every time? Say the designer wants busin
> obj x on page/section y. I have to go into the servlet
> and add it (regression test, and evils like that)? or
> does the servlet look it up in a property file? or how
> ?
Place all objects in a Hashtable or something similar and only put that
into context. Then pick the correct ones from templates. Something like
($biz here is a Hashtable):
---------------------------------
#set($beers = $biz.beers)
#set($people = $biz.people)
---------------------------------
or if you don't want all those objects to initialise up front, this
approach could be useful ($biz here is your class that knows how to pick
other useful objects):
---------------------------------
#set($beers = $biz.getObject("beers"))
#set($people = $biz.getObject("people"))
---------------------------------
where getObject() would only really get make an instance of the ones
that are being used. Those objects could even be stored (serialized)
somewhere in a database.
Bojan