This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes servlet method override Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "servlet method override" Watch "servlet method override" New topic
Author

servlet method override

Harshana Dias
Ranch Hand

Joined: Jun 11, 2007
Posts: 327
Hey,

Is it necessary to throw ServletException in either doGet() or doPost() in the servlet.

i mean like IOException should be throw if we take a PrintWriter out from response object.

Likewise when we need to throw ServletException?

If our method body is blank we dont need to throw none right?

Also what is this processRequest () in servlet when we use tomcat? its not there in Servlet specification right? because it says service() will called either doGet() or doPost() method not processRequest() ?

Thank You.
Bindu Lakhanpal
Ranch Hand

Joined: Oct 17, 2008
Posts: 165

While overriding we may throw fewer or narrower checked exceptions or any unchecked exceptions.
So I think it is not necessary to declare that doGet() or doPost() throws ServletException and IOException.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Harshana Dias wrote:
Also what is this processRequest () in servlet when we use tomcat?


by the way processRequest is nothing to do with tomcat. i guess you are a netbeans man. it is user defined method[which is uesd in side doGet or doPost]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servlet method override
 
Similar Threads
doPost(), doGet()
POST or GET
HTTP Status 405 error comes
About doGet and doPost of Services
GET vs POST-Doubt