Em Mon, 27 Oct 2008 10:36:39 -0300, James Sherwood
<[EMAIL PROTECTED]> escreveu:
I cannot figure out how to produce the SelectionModel from a list of
occupations. I am not sure if I am just being dumb and have been staring
at this too long now or what:)
Use an SelectModel implementation. You can build it yourself or use
SelectModelImpl from Tapestry.
You'll need an OptionModel implementation too. You can build it yourself
or use OptionModelImpl from Tapestry.
My method is this:
public SelectModel getOccupationModel(){
return _session.createCriteria(Occupation.class).list();
}
Your method would look like this (not tested):
public SelectModel getOccupationModel(){
List<Occupation> list =
_session.createCriteria(Occupation.class).list();
List<OptionModel> options = new ArrayList<OptionModel>();
for (Occupation occupation : list) {
options = new OptionModelImpl(occupation.getName(),
occupation.getId());
}
return new SelectModelImpl(null, options);
}
--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]