[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
Create symphonies in seed and soil. For this tiny ad:
Thread Boost - a very different sort of advertising
https://coderanch.com/t/674455/Thread-Boost-feature


This thread has been viewed 936 times.

All times above are in ranch (not your local) time.
The current ranch time is
Apr 21, 2018 07:57:05.