PDA

View Full Version : how to use Exception implicit object in jsp


devendrawaikos
08-16-2007, 08:42 AM
how to use Exception implicit object in jsp, to show the error message?

jkim
08-20-2007, 03:28 AM
Where is the exception being thrown?

If it's by your code, then you should have a try / catch block at the most outer level (or a level most appropriate to) of your code where you handle exceptions.

If the exception is being thrown outside the scope of your code, you may have to write an intermediate servlet. (i.e. exception being thrown in jsp initialization):

Example:

MyJsp.jsp
<%@ import=MyServlet%>
<%@ extends=MyServlet%>

MyServlet.java
public MyServlet extends HttpServlet
{
...
public init()
{
try {
...
super.init();
...
} catch (MyException e) {
// perform error handling
}
}
...
};