Forums Register Login

servlet methods

+Pie Number of slices to send: Send
hi to all,
when we use both doGet() and doPost() methods in a java class, is there any real situations to use these methods,if so pls tell me what are that situations.

Thanks,
vishnu.
+Pie Number of slices to send: Send
I'm not sure what you're asking here.
The doGet and doPost methods are the most commonly overridden methods in a servlet.

Let me turn the question around.
Why would YOU write a servlet?
What would it do?
To do this, what methods do you think you should override in your servlet?
+Pie Number of slices to send: Send
If you mean use both in the same call, I think the answer is no. The server will call a doGet when receives a get request, and a doPost in a post request. You can't receive both kinds of request in the same call.
+Pie Number of slices to send: Send
A servlet may well react differently to GET and POST requests, so it does indeed make sense to have both of them in a servlet. This entry in the Servlets FAQ also deals with the subject.
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 495 times.
Similar Threads
Abstracting away an interface implementation
PAC x MVC
static methods
why do we use static methods?
are these topics covered for the new scjp pattern.pl help
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 20:25:24.