Yeah, this is an ugly situation because converters don't allow
StateHolder like Validators and Components and it's hard to initialize
them with a set of values.

Here's how I handle it.  I store the stuff in a backing bean and
programmically fetch a reference to the backing bean.  In your case,
the value binding would be the same one used in the page tag.

       ValueBinding binding =
FacesContext.getCurrentInstance().getApplication().createValueBinding("#{backingBean.selectItemList}");
       List list = (List )binding.getValue(FacesContext.getCurrentInstance());



On 9/15/06, Sławek Sobótka <[EMAIL PROTECTED]> wrote:
welome back guys. after 1 year of coding fat swt/swing clients i'm
backing to jsf business (and to your great comunity;).

i can't find SelectItems list in nym converter:(

here is the situation:
i have selectManyListbox thats value is binded to List<Workplcae>.
select items are binded to List<SelectItem> but each SelectItem's
value is set to one of the Workplace object.

so we have class situation that needs converter - im working on object
instead of threis IDs cause it is comfortable with hibernate stuff.

w would like to do it like this:
//========================================
public Object getAsObject(FacesContext fc, UIComponent comp, String
str) throws ConverterException {
                UISelectMany selectMany = (UISelectMany) comp;
                List<SelectItem> workplaces = selectMany.
getAllSelectItemsThatAreBindedToComponent(); //<<<======= problem
                Integer id = new Integer(str);
                for (SelectItem o : workplaces)
                        if (((Workplace)o.getValue()).getWorkPlaceId().
equals(id))
                                return o.getValue();
                return null;
        }
//========================================

where can i find method like this:
List<SelectItem> workplaces = selectMany.
getAllSelectItemsThatAreBindedToComponent();
cause i dont want to fetch all Workplaces from DB once again?

best regards Sławek S.

----------------------------------------------------
Codziennie nowe oferty pracy czekają na Ciebie - Sprawdż!
Kliknij: http://klik.wp.pl/?adr=www.praca.wp.pl&sid=870



Reply via email to