Tuesday, October 10, 2017

Addition of Numbers


1. Create a page with two Text boxes and one message styled text for result
2. Add the values from two text boxes and display result when click on Submit Button



Code:

  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
    if (pageContext.getParameter("submit")!=null) {
        String texta = pageContext.getParameter("itema");
        String textb = pageContext.getParameter("itemb");
        int ltotal = Integer.parseInt(texta) + Integer.parseInt(textb);
        OAMessageStyledTextBean  oatotal = (OAMessageStyledTextBean)webBean.findChildRecursive("total") ;
        oatotal.setValue(pageContext,ltotal);       
    }
  }

No comments:

Post a Comment