<%! int add(String x, String y) { return Integer.parseInt(x)+Integer.parseInt(y); } %> Addition The sum of <%= request.getParameter("x") %> and <%= request.getParameter("y") %> is <%= add(request.getParameter("x"),request.getParameter("y")) %>