Radio Button Quandary
Hi all,
I have a data table with radio buttons in the last column.
The value it's bound to is an Integer.
The selectItems list is Integer, String.
I sometimes get aconversion error. So I wrote a custom converter.
Got the program to fail again, but this time I'm gettingValidation Error: Value is not valid
Whoever answers this question for me... may you have a lifetime full of happiness and good fortune. Please help!
[479 byte] By [
Tammy_Ea] at [2007-11-15]

JSP
<h:selectOneRadio value="#{varmyRecs.actionCode}"
layout="lineDirection" id="codes" styleClass="std" converter="RadioConverter">
<f:selectItems value="#{varmyRecs.actionCodes}" />
</h:selectOneRadio>
BEAN
Constructor:
setActionCode(action); // action is Integer
actionCodes = new SelectItem[] { new SelectItem(new Integer(1), "Un-Alloc"),
new SelectItem(new Integer(2), "Un-Sched"),
new SelectItem(new Integer(3), "Re-Sched"),
new SelectItem(new Integer(4), "Delete"),
new SelectItem(new Integer(5), "None") };
Now, those beans, as you know, go in a datatable. When I jump to a page with no records (here's where the dropdown comes in - the dropdown filters the records), and then I click to say show me All the records, that's when I got the conversion error.
Now that I've created a converter, now i'm getting a validation error.
CONVERTER:
getAsObject:
if (target == null || target.trim().equals(""))
return target;
Integer integerValue = new Integer(target.trim());
return integerValue;
getAsString:
String value = ((Integer) target).toString();
return value;