Problem with converter PickList

UI Components for JSF
Post Reply
danielitob
Posts: 11
Joined: 04 Jun 2010, 00:04

26 Jun 2010, 11:53

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.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

26 Jun 2010, 12:14

Please post support questions to the support forum not to this feedback forum. Thanks.

danielitob
Posts: 11
Joined: 04 Jun 2010, 00:04

26 Jun 2010, 16:17

Sorry, my mistake. I moved post to right place, you can delete it.
Regards

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 20 guests