<%@ page language="java" %>
<%@ page import="jspexamples.fiboBean" %>
<%@ page import="jspexamples.overflowException" %>
<%! int fib_val = 0; %>
Fibonacci Series JSP
<%
// Get the Fibonacci values until an exception occurs
for (int i=0;/* loop until exception */ ;i++)
{ // Infinite loop
try
{ // Call the getter directly instead of using the property syntax
fib_val = fibVal.getFibo ();
}
catch (overflowException e)
{
break; // from loop
}
%>
F<%= i%> = <%= fib_val %>
<%
} // end for i loop
%>
An overflow occurred after this number.