| Newsgroups |
gmane.comp.java.sun.kvm |
| Message-ID |
<[email protected]> |
Hi.
I m new to j2me, i want to pass parameter from midlet to servlet , i m using tomcat as web server
plz help me out, coz i dont have any clue about it, i tried my level best, but i got null value in servlet its like this in doGet (req.getParameter("name") )
following is my midlet code.
--------------------------------------------------------
// doConnectToServ(tfName.getString());
public void doConnectToServ(String name){
String tomcatUrl = "http://localhost:8080/ServletClass/getName"+"?"+"name="+name+"&"+"done="+"yes";
HttpConnection c = null;
OutputStream os = null;
InputStream in = null;
try {
c = (HttpConnection) Connector.open(tomcatUrl );
c.setRequestMethod (HttpConnection.POST);
c.setRequestProperty("User-Agent", "Profile/MIDP-1.0 Configuration/CLDC-1.0");
c.setRequestProperty("Content-Language", "en-US");
c.setRequestProperty("Accept", "text/xml");
c.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
c.setRequestProperty("Connection", "close" );
// I get this value NULL <<<<<<<<<<<<<,
System.out.println( c.getRequestProperty(name));
}
catch (IOException ioe) {
System.out.println("Error in IO ");
}
try {
if (in != null) {in.close();}
if (os != null) {os.close();}
if (c != null) {c.close();}
} catch (IOException ioe) {
System.out.println(ioe);}
}
----------------------------------------------------
this is my Servlet Code >
--------
// in doGet
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String result = request.getParameter("name");
out.println(result);
Please guys help me out,
I m stuck with it from a week, I ll b so thankful to u ,
Thank You in Advance
jatin.
[Message sent by forum member 'jatin_1183' (jatin_1183)]
http://forums.java.net/jive/thread.jspa?messageID=263860
===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
[email protected] and include in the body of the message "help".