[英]Oracle adf Addition issue
Guys I am making this simple Addition function in Oracle ADF In which I am taking three input text fields first two for input numbers and third one for output and a button where i have written code for computing the addition operation.on a page after creating Adf Fusion Application in ADF This is the code for 伙计们,我正在Oracle ADF中使这个简单的加法函数生效,其中我要使用三个输入文本字段,前两个用于输入数字,第三个用于输出数字,以及一个按钮,其中我编写了用于计算加法运算的代码。 ADF中的Fusion Application这是用于
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html>
<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:document title="PageAdd.jsf" id="d1">
<af:form id="f1">
<af:inputText label="input1" id="it1" binding="#{Mbean.input1}" autoSubmit="true"/>
<af:inputText label="input2" id="it2" binding="#{Mbean.input2}" autoSubmit="true"/>
<af:inputText label="output" id="it3" binding="#{Mbean.output}" autoSubmit="true"/>
<af:button text="Submit" id="b1" action="#{Mbean.b1_action}"/>
<af:selectBooleanRadio text="selectBooleanRadio 1" label="Label 1" id="sbr1"/>
</af:form>
</af:document>
<!--oracle-jdev-comment:preferred-managed-bean-name:Mbean-->
</f:view>
As you can see the bindings. 如您所见,绑定。 Mbean is the Managed Bean and the part after '.'
Mbean是受管Bean,位于'。'之后。 is the property.
是财产。 In the Button I have created this method called b1_action.
在按钮中,我创建了一个称为b1_action的方法。 Below is the java code.
以下是Java代码。 package view;
包视图;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import oracle.adf.view.rich.component.rich.input.RichInputText;
public class Addition {
private RichInputText input1;
private RichInputText input2;
private RichInputText output;
public Addition() {
}
public void setInput1(RichInputText input1) {
this.input1 = input1;
}
public RichInputText getInput1() {
return input1;
}
public void setInput2(RichInputText input2) {
this.input2 = input2;
}
public RichInputText getInput2() {
return input2;
}
public void setOutput(RichInputText output) {
this.output = output;
}
public RichInputText getOutput() {
return output;
}
public String b1_action() {
String s;
String x;
String v;
s = (String)input1.getValue();
x = (String)input2.getValue();
int r2=Integer.parseInt(x);
int r1= Integer.parseInt(s);
int d =r2+r1;
v =Integer.toString(d);
output.setValue(v);
System.out.println(output.getValue());
return null;
}
}
While my Application is able to take the values and even add together but not able to display it in the third input text field which i am not able to do I am new to this Tool and language Java kindly help me. 虽然我的应用程序可以获取值甚至可以加在一起,但无法在第三个输入文本字段中显示它(我无法做到),但是我对该工具还是陌生的,Java语言可以帮助我。
在您的“输出”组件上添加了部分触发器属性,如下所示:
<af:inputText label="output" id="it3" binding="#{Mbean.output}" autoSubmit=“true" partialTriggers=“ b1"/>
First Make Input 1 and Input 2 autoSubmit="True"
. 首先将输入1和输入2
autoSubmit="True"
。 Then Make partialTriggers="it1 it2"
for Output. 然后为输出设置
partialTriggers="it1 it2"
。 Make the partialSubmit="True"
for the Button. 使Button的
partialSubmit="True"
。
If nothing happend try to write this.output.setValue(V);
如果什么都没发生,请尝试编写
this.output.setValue(V);
After output.setValue(v);
在
output.setValue(v);
add this line of code AdfFacesContext.getCurrentInstance().addPartialTarget(output);
添加此行代码
AdfFacesContext.getCurrentInstance().addPartialTarget(output);
Then set property autoSubmit
to “true”
inside output in your page 然后在页面的输出中将属性
autoSubmit
设置为“true”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.