why are the last 2 options not correct ? no explanation has been provided for them. plz help
Regards
Gurpreet
About Question enthuware.jwpv6.2.648 :
Moderator: admin
-
- Posts: 55
- Joined: Thu Jan 03, 2013 7:51 am
- Contact:
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.648 :
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.
HTH,
Paul.
-
- Posts: 55
- Joined: Thu Jan 03, 2013 7:51 am
- Contact:
Re: About Question enthuware.jwpv6.2.648 :
that is what my question is .why shouldnt we throw exceptions from the service method ?
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.jwpv6.2.648 :
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.
Remember that when the servlet container initializes a servlet there may not be any request at all.
Who is online
Users browsing this forum: No registered users and 6 guests