1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
import java.io.Serializable;
import java.util.*;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.*;
import javax.faces.model.SelectItem;
@ManagedBean(name = "dropdownView")
@ViewScoped
public class UserBean implements Serializable {
private Personne p;
private int a;
private List<Personne> l;
private List<SelectItem> selectItem;
@PostConstruct
public void init() {
l = new ArrayList<Personne>();
l.add(new Personne(123, "a"));
l.add(new Personne(124, "b"));
l.add(new Personne(125, "c"));
l.add(new Personne(126, "d"));
p = new Personne();
}
public List<SelectItem> getSelectItem() {
this.selectItem = new ArrayList<SelectItem>();
for (Personne c : l) {
SelectItem s = new SelectItem(c.getMat(), c.getNom());
this.selectItem.add(s);
}
return selectItem;
}
public void onCountryChange() {
if (p.getNom() != null && !p.getNom().equals("")) {
} else {
}
}
public void setSelectItem(List<SelectItem> selectItem) {
this.selectItem = selectItem;
}
public List<Personne> getL() {
return l;
}
public void setL(List<Personne> l) {
this.l = l;
}
public Personne getP() {
return p;
}
public void setP(Personne p) {
this.p = p;
}
public int getA() {
return a;
}
public void setA(int a) {
this.a = a;
}
} |
Partager