<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <% int a = 0; int b = 0; boolean isParamValid = true; try { a = Integer.parseInt( request.getParameter( "value1" ) ); b = Integer.parseInt( request.getParameter( "value2" ) ); } catch( Exception e ) { isParamValid = false; } %> Add Using JSP <% if( isParamValid ) { %> <%= a %> + <%= b %> = <%= (a+b) %>. <% } else { %> Please enter two integer values:
Value1:
Value2:
<% } %>