[Logo]
Forums Register Login
Catching an Exception inside a Servlet
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.
 

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
Yes it helped .Thanks a lot.

 

Ravi Pavan wrote:Yes it helped .Thanks a lot.



You Are Welcome
Forget this weirdo. You guys wanna see something really neat? I just have to take off my shoe .... (hint: it's a tiny ad)
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss


This thread has been viewed 955 times.

All times above are in ranch (not your local) time.
The current ranch time is
Jul 17, 2018 21:06:32.