This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
sorry I can't understand what you are talking about. doGet() does NOT have to call doPost(), in case you are looking at an example where the doGet just simply calls doPost. that just mean that particular servlet doesn't care whether it is GET or POST. Kyle
yeah, you define both doGet and doPost because your servlet wanna handle both GET and POST HTTP requests. but if your doGet calls doPost, or doPost calls doGet, that just means your servlet treats both GET and POST in the same way, and generates the same response. your doGet never has to call doPost, and the same for doPost. That example is just an example. Kyle
If you just override doPost(req,res) alone , you are making an assumption that you support only POST requests. If in case, you call this servlet through browser address link, then you will get "500 Http Method Not Supported" error. Usually, during development stage, we may want to check if the servlet functions well, by invoking the servlet directly from browser address bar. Making the servlet call doPost() from doGet() is an easy way to overcome this 500 server error (Default implementation) and helps us to proceed with our testing. Regards, Maha Anna