Do you know what is the use to have a doGet() methodinside a doPost() method in servlet like thefollowing?
public void doPost(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException{doGet(req,res);}
Get and Post differ in the way server treats them and you can easily dothe same thing get does in post as long as you don't care. This servletresponds similar to both post and get requests.
We use doGet() method inside the doPost() method to go from DoPost method to DoGet method.
doGet() and doPost() are called in differentocassions, when you call an URL you normally make aGET request, when you put a form and set the <FORMMETHOD=POST> then you have a post request. Forms canbe either get or post, so to process a form requestyuou may program both methods or you mey loose somerequestsso, the easieste way is to call doPost() from doGet()or viceversa or point both of them to your function.
you'd better override these two methods separately . but if you use nested forms or some several frames with separate forms(maybe each form has its own method), in your HTML tags you may need to impelemnting doGet() within doPost() method .
This is the proposed default implementation in servlet specification.If for some reasons you need to handle these methods separately youcan override them.