• Post Reply Bookmark Topic Watch Topic
  • New Topic

transfer an exception from EJB to JSP

 
Diwakar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everybody,
Using an MVC architecture, I had designed an application. A request from a browser goes to a servlet which invokes an EJB to execute a business logic. In my EJB a have some custom exceptions. Now we know that the outcome of the processing is to be presented using a JSP but prior to this the generated response should be sent to the contoller servlet which in turn invokes a JSP. Now my question is that how do we transfer an exception thrown in an EJB to a JSP page???
 
Abhinav Srivastava
Ranch Hand
Posts: 354
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Diwakar k:
Hi Everybody,
Using an MVC architecture, I had designed an application. A request from a browser goes to a servlet which invokes an EJB to execute a business logic. In my EJB a have some custom exceptions. Now we know that the outcome of the processing is to be presented using a JSP but prior to this the generated response should be sent to the contoller servlet which in turn invokes a JSP. Now my question is that how do we transfer an exception thrown in an EJB to a JSP page???


Your EJB methods must be throwing your Custom Exceptions,
catch them in your servlet. Include this Exception information as an attribute in HttpRequest object and forward to your JSP. In your JSP, look up request for that Exception attribute.
 
Diwakar
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jack,
Thanks for your valuable response.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!