View Single Post
Old 01-04-08, 02:40 PM   #4 (permalink)
writetokaruna@yahoo.com
Member
 
Join Date: Mar 2008
Posts: 32
Thanks: 0
Thanked 1 Times in 1 Posts
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 1 writetokaruna@yahoo.com is on a distinguished road
Re: HTTP Status 405 - HTTP method GET is not supported by this URL

Hi,
If client is requesting with get method,then we have to overide doGet() method.otherwise doPost() has to be overidden.If we couldnt predict which method is being used for requesting the servlet,you can overide both doGet and doPost() method.

public void doGet(HttpServletRequest req,HttpRequestResponse res)
throws ServletException
{
doPost(HttpServletRequest req,HttpRequestResponse res);
}
public void doPost(HttpServletRequest req,HttpRequestResponse res)
throws ServletException
{
//write ur logic
}

If we go on this way,we dont need to bother about which method our browser supports or from method the client is requesting.Our servlet can respond for any kind of request coming from client.

Thanks.Comments r welcome.

Regards,
R.P.Karunakaran
writetokaruna@yahoo.com is offline   Reply With Quote