aspose file tools*
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 Spring in Action this week in the Spring 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: 12806
    
    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!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Unable to pass string from applet to servlet