Am a newbie to Servlets.. so please bear with me. I am using WSAD IDE
I wrote the following code in a Servlet named LoginServlet
This does not work as of now.But, if I copy paste everything into the doGet() method instead of the doPost(), it works fine. Is it because by default a doGet() method is called and thats why the above code should be in the doGet() instead of the doPost() method as this is the first Servlet?
Originally posted by Rajkumar balakrishnan:
Yes..by default doGet() method is taken by HTML
It is NOT by HTML but HTTP, the protocol which is the actual channel/mediator using which the client (browser) communicates with the server.
and if you want to overcome this problem just do this
public void doGet(....)
If you do this so you need not to worry about the method in HTML...I hope so..
Here again, the HTML is just a tool which the client (browser) can understand (render) and display its contents. I guess Rajkumar was intended to say HTTP but he typed HTML .
What he has done here is he has called the doPost() method inside doGet(). So no matter which method is actually invoked from HTTP, the container(server) would delegate it to doPost() at the end ultimately -- just to explain the piece of code given by Rajkumar.
Hope this helps!
[ July 10, 2008: Message edited by: Raghavan Muthu ]