Try catch in JSP

by Geethalakshmi 2008-12-12 20:05:30

Try catch in JSP:

In try block we write those code which can throw exception while code execution and when the exception is thrown it is caught inside the catch block. The try catch block in jsp just work as try catch block in the java.

The code of the program is given below:

<HTML>
<HEAD>
<TITLE> Use of Try catch in jsp</TITLE>
</HEAD>
<BODY>
<table align="center" bgcolor="#E1E1FF" border="1">
<H1>Use of Try catch in jsp</H1>


<%
try{
int a = 10;
int b = 10;
b = a / 0;
}
catch(Exception e){
out.println("The Error is: " + e);
}
%>
</table>
</BODY>
</HTML>

Tagged in:

1578
like
0
dislike
0
mail
flag

You must LOGIN to add comments