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