Guys,
Using JDev 11.1.1.2.0. Fairly new and can't find an answer to this simple question. I've googled and looked through both the JDev 11g and Fusion handbooks, and fiddled with the code on and off for weeks now.
How do I take an af:inputText JSF component binding and convert the form's input into a Number I can pass to a methodAction?
I receive a RichInputText to Java.lang.Number conversion error at every turn.
I've created a very simple sample below.
HTML
...
<af:form id="f1">
<af:inputText label="Text to Convert" id="it1"
converter="javax.faces.Number"
binding="#{PageBackingBean.textInput}">
<af:convertNumber type="number"/>
</af:inputText>
<af:commandButton text="Convert" id="cb1"
actionListener="#{PageBackingBean.convertButton}"/>
</af:form>
...
adfc-config
<adfc-config xmlns="http://xmlns.oracle.com/adf/controller" version="1.2">
<managed-bean id="__2">
<managed-bean-name id="__4">PageBackingBean</managed-bean-name>
<managed-bean-class id="__1">PageBackingBean</managed-bean-class>
<managed-bean-scope id="__3">request</managed-bean-scope>
</managed-bean>
</adfc-config>
pageDef
<methodAction id="insertRow"
InstanceName="AppModuleDataControl.dataProvider"
DataControl="AppModuleDataControl" RequiresUpdateModel="true"
Action="invokeMethod" MethodName="insertRow"
IsViewObjectMethod="false">
<NamedData NDName="Qty" NDValue="#{PageBackingBean.textInput}"
NDType="java.lang.Number"/>
</methodAction>
managed bean code
...imports...
public class PageBackingBean
{
private RichInputText textInput;
...
public void setTextInput(RichInputText textInput){
this.textInput = textInput;
}
public RichInputText getTextInput(){
return textInput;
}
public BindingContainer getBindings(){
return BindingContext.getCurrent().getCurrentBindingsEntry();
}
public void convertButton(ActionEvent actionEvent){
BindingContainer bindings = getBindings();
OperationBinding operationBinding =
bindings.getOperationBinding("insertRow");
operationBinding.execute();
}
}