package untitled3;

import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.Action;

public class addAction
    extends Action {
  public ActionForward execute(ActionMapping actionMapping,
                               ActionForm actionForm,
                               HttpServletRequest servletRequest,
                               HttpServletResponse servletResponse) {
    addActionForm addActionForm = (addActionForm) actionForm;
         Float num1 = addActionForm.getNum1();
         Float num2 = addActionForm.getNum2();
         if (num1.floatValue()>= 0 && num2.floatValue()>=0) {
                    float num3=num1.floatValue()+num2.floatValue();
                    System.out.print(num3);
                    servletRequest.setAttribute("result",new Float(num3));
             return actionMapping.findForward("success");
         }
         else
             return null;
     }

}
