How To Catch an exception in jsp which thrown from a jar file


EJB design: How To Catch an exception in jsp which thrown from a jar file

  1. Please suggest me an approach to catch an Exception thrown from a jar file,and needs to be display in the jsp file. We are using j_security_check action which is provided by the web server(Jboss server) for login authentication. rigth now we are receiving either success or failure but we want to display specific type of exception like user name not found ,password wrong .How can we catch and display exceptions in jsp.
  2. The following link may help you Thanks, Anil.
  3. Use a try catch block in your jsp code where exception is thrown. A jsp class can throw ServletException, IOException and RuntimeException and Also JspException. Try to catch and throw one of these depending on the exception kind. Else, catch them in custom tag classes. I wonder wats the link with got to do with the question.
  4. Thanks for ur help. but the thing is we are not writing anything in the jsp.we need to display custom exceptions,we are thinking about where we need to store the exception to transfer this exception from jar file to jsp page.Again jsp not interacting with the jar file. there is a container provided servlet that will forward the jsp on which we need to display exception. can u explain a bit broadly how custom tag classes will be done.
  5. Extend the Servlet;) and check for valid Data;) and throw your custom Exceptions on will;)