myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bart Kummel <bkum...@gmail.com>
Subject Re: Problem with combination of f:selectItems and tr:selectOneChoice...
Date Tue, 06 Apr 2010 15:01:16 GMT
Hi Lukasz,

I don't understand the error message, it is not in English. Can you
configure your appserver to generate English error messages?

Best regards,
Bart

2010/4/6 Lukasz Feldman <lukasz.feldman@googlemail.com>

> Hi,
>
> I have some challenging problem which makes me a little nervouse since I
> have started to solve it few days ago. I want to combine f:selectItems with
> tr:selectOneChoice. Here is code snippet:
>
> something.xhtml:
> -------------------------
> (...)
> <tr:selectOneChoice
> partialTriggers="slownikRisAparatow"
> actionListener="#{konsolaadminabb.ustawRisAparat}"
> value="#{konsolaadmina.risAparat.slownikRisPracowni}"
> label="w pracowni">
> <f:selectItems value="#{slownikibb.risPracownieSlownik}"/>
> <f:converter converterId="risPracowniReadWriteConverter"/>
> </tr:selectOneChoice>
> (...)
>
> konsolaadminabb.java:
> ---------------------------------
> (...)
> public void ustawRisAparat(ValueChangeEvent event) {
>        risAparat = (SlownikRisAparatow) event.getNewValue();
>        DetachedCriteria criteria =
> DetachedCriteria.forClass(SlownikRisPracowni.class);
>        criteria.setFetchMode("slownikRisAparatows",
> FetchMode.DEFAULT).createAlias("slownikRisAparatows",
> "aparat").add(Restrictions.eq("aparat.id", risAparat.getId()));
>        risAparat.setSlownikRisPracowni(new
> RisPracowniSlownikDAO().findByCriteria(criteria).get(0));
> (...)
> slownikibb.java:
> ----------------------
> (...)
> public List<SelectItem> getRisPracownieSlownik() {
>        List selectItemList = new ArrayList();
>        for (SlownikRisPracowni pracownia :
> slownikiService.zaladujRisPracowniSlownik()) {
>            selectItemList.add(new
> SelectItem(Long.toString(pracownia.getId()),
> pracownia.getNazwaPracowni()));
>        }
>        return selectItemList;
>    }
> (...)
> risPracowniReadWriteConverter:
> -----------------------------------------------
> public class RisPracowniReadWriteConverter implements Converter {
>
>    private Logger logger = Logger.getLogger("com.pac5");
>
>    public Object getAsObject(FacesContext arg0, UIComponent arg1, String
> arg2) {
>        if (arg2.equals(null)) {
>            return null;
>        }
>        return (Object) new RisPracowniSlownikDAO().findById(arg2);
>    }
>
>    public String getAsString(FacesContext arg0, UIComponent arg1, Object
> arg2) {
>
>        if (arg2==null) { return ""; }
>        SlownikRisPracowni pracownia = new
> RisPracowniSlownikDAO().findById(arg2.toString());
>        return Long.toString(pracownia.getId());
>    }
>
> As a result of this I have a problem like this:
>
> 2010-04-05 23:10:35 org.apache.myfaces.
> trinidadinternal.renderkit.core.xhtml.SimpleSelectOneRenderer
> _getSelectedIndex
> WARNING: Nie znaleziono wybranego elementu zgodnego z wartością
> "com.pac5.datamodel.pojos.ris.dictionaries.SlownikRisPracowni@1b3114" w
> CoreSelectOneChoice[UIXEditableFacesBeanImpl, id=j_id213]
>
> Has anyone idea what is going on?
>
> BR,
>
> Lukasz
>



-- 
___________________________________________________________
Bart Kummel

Author of the book "Apache MyFaces 1.2 Web Application Development"
See http://tinyurl.com/am12wad

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message