Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Catching an Exception inside a Servlet

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,


This is the scenario . I have a servlet calling a DAO Layer which is implemented in Hibernate . I want to show an appropiate page when an exception occurs for which i had configured exceptions and locations inside web.xml file.

If an User Defined Exception (say RecordNotFoundException) is thrown inside the DAO Layer .

Is it sufficient to just use throw new RecordNotFoundException inside the DAO Layer ? or is it necessary the servlet should also catch this exception ??



Please help.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravi Pavan wrote:
Is it sufficient to just use throw new RecordNotFoundException inside the DAO Layer ?

Yes

Ravi Pavan wrote:
is it necessary the servlet should also catch this exception ??


Not Required

Hope this helps
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it helped .Thanks a lot.

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravi Pavan wrote:Yes it helped .Thanks a lot.


You Are Welcome
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic