wood burning stoves
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes HTTP status 405 Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "HTTP status 405 Error" Watch "HTTP status 405 Error" New topic

HTTP status 405 Error

pallavi utukuri
Ranch Hand

Joined: Feb 10, 2004
Posts: 182
Person.class is in D:\Tomcat4.1\webapps\foo\WEB-INF\classes

package foo;
public class Person{
private String name;

public void setName(String name){
public String getName(){
return name;

BeanEx.class is in D:\Tomcat4.1\webapps\foo\WEB-INF\classes

package foo;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class BeanEx extends HttpServlet{
public void doPost(HttpServletRequest request,HttpServletResponse response)throws IOException,ServletException {
foo.Person p = new foo.Person();
RequestDispatcher view = request.getRequestDispatcher("result.jsp");

result.jsp in D:\Tomcat4.1\webapps\foo

person is: <%= request.getAttribute("person") %>

web.xml in D:\Tomcat4.1\webapps\foo\WEB-INF

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"


http://localhost:8080/foo/Tester.do is giving the error

HTTP Status 405 - HTTP method GET is not supported by this URL

where is it going wrong?

Thanks,<br />Pallavi
Raju Sri
Ranch Hand

Joined: Mar 10, 2004
Posts: 108
Hi Pallavi,

Obviously your servlet doesn't implement doGet method, that's why you are getting error while accessing http://localhost:8080/foo/Tester.do through browser.Whenever we access some thing directly on the browser, GET method will be triggered.

So try calling the Tester.do from html page like below then POST will be triggered.

<form name="test" action="Tester.do" method="POST">
<input type=submit>

SCJP 1.4<br />SCWCD 1.4<br />SCBCD 1.3<br />SCDJWS 1.4
pallavi utukuri
Ranch Hand

Joined: Feb 10, 2004
Posts: 182
Thanku Raju, i forgot that Get is the default...
I agree. Here's the link: http://aspose.com/file-tools
subject: HTTP status 405 Error
It's not a secret anymore!