I feel the same. But you have to remember that GET has upper cape on parameters size � so just you may like to apply checks related if you are sending really long strings or too many parameters. Otherwise in normal situation, I don�t feel to have any checks. [ October 06, 2006: Message edited by: Chetan Parekh ]
In case you are calling a doGet from a doPost , doGet behaves like any other normal java method.Actually those are callback methods which the service method is suppose to call after determining the HTTP method from the request.
Originally posted by Rahul Bhattacharjee: In case you want similar behaviour for both GET and POST requests then you might even choose to override the service method itself.
GET and POST are not the only HTTP methods that exist. Overriding service() would kill the distinction between these and the other methods, like HEAD. If all one is trying to do is make the behaviour for GET and POST the same, then the best way is to make doGet call doPost (or maybe vice versa).
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Just remember that there are very different reasons as to why someone might be calling a doGet, as opposed to a doPost.
If your servlet should only be called from a form, and doPost handles this, then you need to know why the doGet has been called. Has someone just clicked on a bookmark? Has someone typed the URL in, instead of clicking submit on the form? Has the page simply been refreshed after the session has timed out?
State management in a Servlet is always a tricky issue. Simply calling doPost from doGet might mean you're avoiding a variety of state management issues.
I know that the VisualAge for Java and eariler editions of WebSphere Studio actually had a third method that each post/get/head method would call. That way you could handle management issues in the appropriate get/post method, and then perform the web based control logic in the third method. Of course, having said that, I've noticed that have stopped doing that in IBM's Raional Application Developer (IRAD)
But otherwise, just calling doPost from doGet is fine.
Joined: Sep 16, 2004
Originally posted by Kameron McKenzie: If your servlet should only be called from a form, and doPost handles this, then you need to know why the doGet has been called. Has someone just clicked on a bookmark? Has someone typed the URL in, instead of clicking submit on the form? Has the page simply been refreshed after the session has timed out?