I'm implementing a webapp using Jsf 2.0 and Primefaces 3.2.
I've noticed this unexpected behavoiur: I have a selectOneMenu
and a commandButton
, as below
<p:selectOneMenu id="selsel" value="#{bean.myObj}">
<f:selectItems value="#{bean.myObjList}" />
</p:selectOneMenu>
<p:commandButton id="btnid" value="Ok" actionListener="#{bean.updateSelectValues()}" />
What happens is that if myObj
is not a String
, the updateSelectValues
method is not called. I can't see any exception or error at all, it's just not called. Here's the backing bean:
private List<MyObj> myObjList;
private MyObj myObj;
// getters and setters
public void updateSelectValues() {
System.out.println(this.myObj);
}
The code for myObj:
public class MyObj implements Serializable {
private static final long serialVersionUID = 1L;
private String param1;
private int param2;
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("MyObj [param1=");
builder.append(this.param1);
builder.append(", param2=");
builder.append(this.param2);
builder.append("]");
return builder.toString();
}
}