Click on this link for Step by Step Document: Sum of Two Numbers
Source Code:
public String
onAddClick()
{
{
System.out.println("*** Add Button Click ****");
int tot=0;
if
(getValue1().getValue()!=null && getValue2().getValue()!=null) {
int a=
Integer.parseInt(getValue1().getValue().toString());
int b=
Integer.parseInt(getValue2().getValue().toString());
tot=a+b;
sumValue.setValue(tot);
UIRefresh(sumValue);
}
return null;
}
public String
onClearClick()
{
{
System.out.println("*** Clear Button Click ****");
value1.resetValue();
value2.resetValue();
sumValue.resetValue();
UIRefresh(value1);
UIRefresh(value2);
UIRefresh(sumValue);
return null;
}
public void
UIRefresh(UIComponent obj)
{
{
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(obj);
}
No comments:
Post a Comment