Package beans

Examples of beans.Operation


    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        ServletContext sc = getServletContext();
        Operation operation = (Operation) request.getAttribute("operationBean");

        BigInteger firstNumber = new BigInteger(operation.getFirstNumber());
        BigInteger secondNumber = new BigInteger(operation.getSecondNumber());

        String result;
        try {
            result = calculate(firstNumber, secondNumber, operation.getOperator()).toString();
        } catch (ArithmeticException ex) {
            result = "Illegal Operation";
        }
        operation.setResult(result);
        request.setAttribute("operationBean", operation);

        request.getRequestDispatcher("result.jsp").forward(request, response);
    }
View Full Code Here

TOP

Related Classes of beans.Operation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.