Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

A Simple 405 error

843841May 2 2003 — edited May 2 2003
I am getting a 405 error in the web browser and in my client MIDlet whenever it performs a post operation and the servlet tries to grab via the code shown below.

I am not doing anything fancy just want to get a string as a parameter in the servlet and print it out that is all I have to do to get the MIDlet to receive it.
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;

public class PostServlet extends HttpServlet {
  public void doPost(HttpServletRequest request,
      HttpServletResponse response)
      throws ServletException, IOException {
    String name = request.getParameter("name = ");

    String message = "Received name: " + name + "'";
    response.setContentType("text/plain");
    response.setContentLength(message.length());
    PrintWriter out = response.getWriter();
    out.println(message);
  }
}
I am using tomcat 4.1 on jdk 1.4.1 I am not sure why I get this error. The url pattern used in the clients is:

http://localhost:8080/myapp/servlet/PostServlet

If anyone explain what has happened I would be greatful.

Prash
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 30 2003
Added on May 2 2003
2 comments
111 views