doPost error

HI,

I am beginner to servlet.

when i run simple servlet using doPost I have the

HTTP method GET is not supported by this URL message error.

Anyone can plz explain How i run simple servlet using doPost or give your own sample code.

I mentioned here my web.xml file.

<web-app>

<servlet>

<servlet-name>ServletDemo</servlet-name>

<servlet-class>pack.ServletDemo

</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>ServletDemo</servlet-name>

<url-pattern>/*</url-pattern>

</servlet-mapping>

</web-app>

what's wrong with it..? kindly explain or give one sample to me.

Thanks & Regards,

kumar

[871 byte] By [kumartnja] at [2007-11-26 16:31:14]
# 1

HTTP requests come in two forms: GET and POST. Whenever you reference a servlet through a HTTP link or directly using the browser navigation bar, that will result in a GET request. If you do not implement the doGet() method on the servlet called, you'll get your error.

A simple way to fix your problem is to do this:

public void doGet(HttpServletRequest request, HttpServletResponse response)

throws IOException, ServletException

{

doPost(request, response);

}

gimbal2a at 2007-7-8 22:55:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
thank u.yes. now its ok.Thanks & Regards,kumar
kumartnja at 2007-7-8 22:55:45 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...