About Question enthuware.jwpv6.2.648 :

Moderator: admin

Post Reply
gurpreet_asrgndu
Posts: 55
Joined: Thu Jan 03, 2013 7:51 am
Contact:

About Question enthuware.jwpv6.2.648 :

Post by gurpreet_asrgndu »

why are the last 2 options not correct ? no explanation has been provided for them. plz help

Regards
Gurpreet

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.648 :

Post by admin »

The last 2 options are not correct because they are opposite to option 1 and 2, which are correct, i.e. you should throw the appropriate exceptions from the init method (and not from the service method). So both can't be correct.

HTH,
Paul.

gurpreet_asrgndu
Posts: 55
Joined: Thu Jan 03, 2013 7:51 am
Contact:

Re: About Question enthuware.jwpv6.2.648 :

Post by gurpreet_asrgndu »

that is what my question is .why shouldnt we throw exceptions from the service method ?

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.jwpv6.2.648 :

Post by admin »

Because if the servlet is not initialized, how will you execute the service method? If the problem is with initialization, the exception should be thrown from the initializer. Why would you throw it from service??

Remember that when the servlet container initializes a servlet there may not be any request at all.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest