Hello,
Please tell me if this is a good approach...
In my web application, I have many comboboxes (<select>),
holding constant sets of values. These sets are represented by
Tapestry's IPropertySelectionModels. I hold their instances
in my SelectionModelPool object and initialize them lazily
when needed. The SelectionModelPool object is held in
the Global object, so there could be less reads from the database:
public abstract class SomePage
{
public IPropertySelectionModel getCountriesSelectionModel()
{
return getGlobal().getSelectionModelPool().get("countries");
}
/* ... */
}
public class SelectionModelPool
{
private Map pool = new Hashmap();
public IPropertySelectionModel get(String name)
{
if (pool.get(name) == null)
{
// fetch the data from the database
// create an instance of IPropertySelectionModel
// insert it into "pool" map
}
return pool.get(name);
}
/* ... */
}
Is it OK?
What if I'd like to force SelectioModelPool refresh
by issuing sth like "getGlobal().getSelectionModelPool().pool.clear()"
- will it work?
Thanks for any help!
.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]