Page 1 of 1

Problem with converter PickList

Posted: 26 Jun 2010, 11:53
by danielitob
Hi guys,
i have a problem, i hope you can help me, on this forum i always found useful info.
My issue is with pickList component, i was following primefaces user's guide example, but i have problem with example for objects.
This is my xhtml page:

Code: Select all

 <p:pickList value="#{formazioneGruppoBean2.players}" var="player" itemLabel="#{player.cognome}" itemValue="#{player}" converter="player">        
            </p:pickList>
The ManagedBean is:

Code: Select all

@ManagedBean
public class FormazioneGruppoBean2 {

    private DualListModel<Professionista> players;

    public FormazioneGruppoBean2() {

        //Players
        List<Professionista> source = new ArrayList<Professionista>();
        List<Professionista> target = new ArrayList<Professionista>();
        source.add(new Professionista("Messi"));
        source.add(new Professionista("Ibrahimovic"));
        source.add(new Professionista("Henry"));
        players = new DualListModel<Professionista>(source, target);
    }
......
The Object is:

Code: Select all

public class Professionista {
    private String email;
    private String nome;
    private String cognome;
.....
    public Professionista(String cognome) {
        this.cognome = cognome;
    }
I have 2 problems:
1)

Code: Select all

Expression Error: Named Object: player not found.
i think i should define a converter in the page with id = "player", but i cannot able to do it. Could you help me?
2) a strange issue is that in xhtml page my ide (netbeans) doesn't give me autocomplete function when i enter

Code: Select all

 itemLabel="#{player.cognome}"

that is doesn't show me properties of Professionista object, so i forced it manually.

Re: Problem with converter PickList

Posted: 26 Jun 2010, 12:14
by cagatay.civici
Please post support questions to the support forum not to this feedback forum. Thanks.

Re: Problem with converter PickList

Posted: 26 Jun 2010, 16:17
by danielitob
Sorry, my mistake. I moved post to right place, you can delete it.
Regards