1. Use explicit try/catch structures in your JSP
This has the advantage that you can create an error message using the current value of variables.
2. Designate an errorPage for your JSP and handle the exception there.
Both of these are going to write a normal HTML page to the browser.
Catch the exceptions in your controller. Use them to populate some place where you store errors, let's say you have a dedicated request- or session-scoped error JavaBean. If any exceptions have been thrown, forward the request back to the JSP the user came from.
To the user, the effect is that of an error message popping up on the screen (s)he tried to submit.
[This message has been edited by Peter den Haan (edited May 07, 2001).]
Originally posted by Yamini Krishnamurthi:
I am using EJB to connect to SAP through an intermediate interface of Java classes. All the exceptions raised at the various stages, I am having them thrown back to the JSP. I need to catch the exceptions in my JSP and pop it up as an alert. How do I do it?
Thanks in advance
i have a code fragment which i hope will satisfy your requirements....
<%@ page language="java" import="java.sql.*" %>
throw new Exception();
this is a jsp code which has a try-catch block. the try block throws an exception which is caught and a alert box is displayed. execute this code and check if you get what u want...