Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

parameter from MIDlet cannot be displayed at servlet

 
Mohd Hafiz Ishak
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a parameter value "hello" is send by midlet ( String message = "name=hello"; ) to servlet. and servlet responds to MIDlet(at MIDlet display " Received name:hello "). ..im using tomcat 5.5. below is a servlet code

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);
}
}

its appear "HTTP Status 405 - HTTP method GET is not supported by this URL" when i try to run at tomcat..
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65115
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mohd Hafiz Ishak:

its appear "HTTP Status 405 - HTTP method GET is not supported by this URL" when i try to run at tomcat..


Look at this error message, then look at the code for your servlet.

Do you see anywhere where you wrote support code for GET?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic