This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes Unable to pass string from applet to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Unable to pass string from applet to servlet " Watch "Unable to pass string from applet to servlet " New topic
Author

Unable to pass string from applet to servlet

Alistair Andrew
Greenhorn

Joined: Apr 10, 2013
Posts: 2
I'm trying to pass a string from an applet to a servlet's doGet method but it keeps returning null on the servlet side. Any ideas on why this is happening, and how to debug this kind of problem in the future?
Applet Code
Servlet Code
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12757
    
    5
The setRequestProperty method sets a request header, it does NOT give the effect of a form parameter that you would use getParameter for.

Form parameters to be read by doGet should be put in the URL string - for doPost they go in the body of the request.

for debugging, having a browser plugin that shows exactly what is being transmitted and received such as Firebug for Firefox is what you want.

Bill
Alistair Andrew
Greenhorn

Joined: Apr 10, 2013
Posts: 2
Wow, I actually knew that but somehow I didn't think that it would be as easy as putting the field straight into the URL.

I just pasted the shiftDate right into the URL and it worked first time! Thank you very much!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to pass string from applet to servlet
 
Similar Threads
HttpURLConnection.
Servlet Communication using java.net
applet-servlet comm using obj serialization --- william,thomas, maha please help
Applet can't find Servlet file
applet to servlet