*sniff* Can't figure it out! :( Applet Servlet communication!
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, August 9, 2001 09:15 PM

Hi there! Ok, please help me! I've figured that no one helps if you post too many times. I just need help! I've read a jGuru article about applet to servlet communication, but it didn't work. It had to do with opening a connection to the servlet through URLconnection, which would have worked fine, but it uses GET, and I needed to output. I don't necessarily NEED to use POST, but I want to give parameters to the servlet. I know that GET from the address bar using a query string will work, but I need to do it from an applet. Is there any way to actually open a connection to the servlet using a query string that doesn't output or input? Like, for the URL use "http://localhost:8080/examples/servlet_name?param1=value1;blah=blahvalue&q   More>>

Hi there!



Ok, please help me! I've figured that no one helps if you post too many times. I just need help! I've read a jGuru article about applet to servlet communication, but it didn't work. It had to do with opening a connection to the servlet through URLconnection, which would have worked fine, but it uses GET, and I needed to output. I don't necessarily NEED to use POST, but I want to give parameters to the servlet. I know that GET from the address bar using a query string will work, but I need to do it from an applet. Is there any way to actually open a connection to the servlet using a query string that doesn't output or input? Like, for the URL use "http://localhost:8080/examples/servlet_name?param1=value1;blah=blahvalue" and then just not doing anything? I don't want to use a redirect, because that changes the page and makes an annoying clicking sound. Anyway, I HOPE you can help :(



THANKS!

   <<Less

Re: *sniff* Can't figure it out! :( Applet Servlet communication!

Posted By:   AlessandroA_Garbagnati  
Posted On:   Thursday, August 9, 2001 09:41 PM

Hi,

let's start saying that

> no one helps if you post too many times

is wrong: if you post the same question many times you just appear as a uneducated person... (to be polite).


Let's start saying that the probable reason why you weren't able to pass parameters is that you're using the wrong syntax:

> http://localhost:8080/examples/servlet_name?param1=value1;blah=blahvalue

the separator, in fact, is not ';' but the '&' sign.


The second problem is the java.net.URLConnection class. You say that it uses only GET, but this is wrong. If you read this FAQ (How can an applet or application pass data to and read output from a CGI script or Servlet?), you can see a very small sample code that execute a POST using URLConnection. You probably need to work on it to fit you needs, but it's ok. Plus, there are many other messages that explain how to do POST with URLConnection.


This should be enough... don't you think.?

About | Sitemap | Contact