C
Christoph Dahlen
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I cannot figure out how to populate a managed bean's property of type
int with a <f:selectItem> tag inside a <h:selectOneListbox>. Here's some
code:
Managed-Bean:
package test;
public class Bean {
private int value;
public void setValue(int value) {
this.value = value;
}
public int getValue() {
return this.value;
}
}
faces-config:
<managed-bean>
<managed-bean-name>bean</managed-bean-name>
<managed-bean-class>test.Bean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
JSF:
<h:selectOneListbox value="#{bean.value}" size="1">
<f:selectItem itemValue="2" itemLabel="2" />
<f:selectItem itemValue="3" itemLabel="3" />
<f:selectItem itemValue="4" itemLabel="4" />
</h:selectOneListbox>
Result: "Validierungs-Fehler: Wert nicht göltig." (reads: Validation
error, invalid value).
Where is my mistake or is it just impossible to populate none-String
properties using static selectItem elements?
Cheers,
Christoph
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFDn0fX94TMRoWcFYRAmc8AJ9Mon/tuYg+7ZWAPibEt5cPI/u7qgCgtDhv
NCkJkhXoa7ajr4d0+MHGLak=
=IK/Z
-----END PGP SIGNATURE-----
Hash: SHA1
Hi,
I cannot figure out how to populate a managed bean's property of type
int with a <f:selectItem> tag inside a <h:selectOneListbox>. Here's some
code:
Managed-Bean:
package test;
public class Bean {
private int value;
public void setValue(int value) {
this.value = value;
}
public int getValue() {
return this.value;
}
}
faces-config:
<managed-bean>
<managed-bean-name>bean</managed-bean-name>
<managed-bean-class>test.Bean</managed-bean-class>
<managed-bean-scope>application</managed-bean-scope>
</managed-bean>
JSF:
<h:selectOneListbox value="#{bean.value}" size="1">
<f:selectItem itemValue="2" itemLabel="2" />
<f:selectItem itemValue="3" itemLabel="3" />
<f:selectItem itemValue="4" itemLabel="4" />
</h:selectOneListbox>
Result: "Validierungs-Fehler: Wert nicht göltig." (reads: Validation
error, invalid value).
Where is my mistake or is it just impossible to populate none-String
properties using static selectItem elements?
Cheers,
Christoph
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFDn0fX94TMRoWcFYRAmc8AJ9Mon/tuYg+7ZWAPibEt5cPI/u7qgCgtDhv
NCkJkhXoa7ajr4d0+MHGLak=
=IK/Z
-----END PGP SIGNATURE-----