<%
/* Do this at the top of the page */
String inputPageURL = "/input.jsp";
int numberInput = 0;
try {
numberInput = Integer.parseInt(request.getParameter("numberInput"));
}
catch (NumberFormatException nfe) {
request.setAttribute("errorMessage","Invalid Input");
/* Redirect Request to Input Page */
try {
RequestDispatcher rd = request.getRequestDispatcher(inputPageURL);
rd.forward(request,response)
}
catch (Exception e) {
/* Do your error handling */
}
}
/* REST OF PAGE */
%>