@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);
}