probleme avec selectOneRadio
salut, je veut utiliser selectOneRadio pour basculer de niveau de log dans mon application:
j'ai deux problemes :
- comment attribuer une valeur par defaut(par example je veut que info soit coché par defaut)
- la methode valueChangeListener n'est pas appelé
Code:
1 2 3 4 5 6 7 8
| <h:selectOneRadio id="myRadio" valueChangeListener="#{servicesOperations.modifierLevel}"
value="#{servicesOperations.choixLogLevel}" >
<f:selectItem itemValue="0" itemLabel="debug"/>
<f:selectItem itemValue="1" itemLabel="info"/>
<f:selectItem itemValue="2" itemLabel="warn"/>
<f:selectItem itemValue="3" itemLabel="error"/>
<f:selectItem itemValue="4" itemLabel="fatal"/>
</h:selectOneRadio> |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| public class ServicesOperations {
private String choixLogLevel=null;
public String getChoixLogLevel() {
return choixLogLevel;
}
public void setChoixLogLevel(String choixLogLevel) {
this.choixLogLevel = choixLogLevel;
}
public ServicesOperations() {
}
public void modifierLevel(ValueChangeEvent evt)
{
System.out.println("radio appelé");
} |