0
I’m developing a web application and java web jsf primefaces, <f:selectItems
/> do not appear
Look at this
<h:panelGroup layout="block" styleClass="parcelas">
<p>Parcelas:</p> <p:selectOneMenu id="tamanhos" value="#{parcela.parcelas}" styleClass="tamanho" effect="fold" editable="true">
<f:selectItem itemLabel="Selecione " itemValue=""/>
<f:selectItems value="#{parcela.Parcelas()}"/>
</p:selectOneMenu>
</h:panelGroup>
<h:panelGroup layout="block" styleClass="tamanho">
<p>Tamanho:</p> <p:selectOneMenu id="tamanhos" value="" styleClass="tamanho" effect="fold" editable="true">
<f:selectItem itemLabel="Selecione " itemValue=""/>
<f:selectItems value="#{tamanho.Tamanhos()}"/>
</p:selectOneMenu>
</h:panelGroup>
@ManagedBean(name="tamanho")
@RequestScoped
public class Tamanho {
private Map<String,String> tamanhos = new HashMap<String, String>();
private String tamanho;
public Map<String, String> Tamanhos(){
tamanhos = new HashMap<String, String>();
tamanhos.put("PP", "PP");
tamanhos.put("P","P");
tamanhos.put("M","M");
tamanhos.put("G","G");
tamanhos.put("GG","GG");
return tamanhos;
}
public String getTamanho() {
return tamanho;
}
public void setTamanho(String tamanho) {
this.tamanho = tamanho;
}
}
@ManagedBean(name="parcela")
@RequestScoped
public class Parcelas {
private int parcelas;
private Map<Integer,Integer> parcela= new HashMap<Integer,Integer>();
public Map<Integer, Integer> Parcelas(){
parcela = new HashMap<Integer, Integer>();
parcela.put(1, 1);
parcela.put(2, 2);
parcela.put(3, 3);
parcela.put(4, 4);
parcela.put(5, 5);
parcela.put(6, 6);
parcela.put(7, 7);
parcela.put(8, 8);
parcela.put(9, 9);
parcela.put(10,10);
parcela.put(11,11);
parcela.put(12, 12);
return parcela;
}
public int getParcelas() {
return parcelas;
}
public void setParcelas(int parcelas) {
this.parcelas = parcelas;
}
}
man I put it the way you told me but select items is gone
– User1999
Did you test it too? <f:selectItems value="#{size.Sizes()}" var="t" itemValue="#{t. key}" itemLabel="#{t. value}"/>
– Robson
Face I really think you’ll have to change your get method!
– Robson
It has to look like this public Map<String, String> getTamanho() { Return Sizes; }
– Robson
that’s right, thank you
– User1999