----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
Hi!
We are now designing a communication 'applet to
servlet'. We are doing it this way:
APPLET TO SERVLET
-----------------
The communication from applet to servlet can be done
by opening an URL connection:
String cadenaConexion =
"https://www.domain.com/servlet/MiServlet?¶m=valor_param";
// You can also use the URLEncode to
transform a string to the format expected by the
servlets
// Then you open the connection:
URL url = new URL( cadenaConexion.toString()
);
URLConnection urlConnection =
url.openConnection();
BufferedReader buffer = new BufferedReader(
new InputStreamReader( urlConnection.getInputStream()
));
String linea = null; StringBuffer respuesta =
new StringBuffer();
while ( (linea = buffer.readLine() ) != null )
{
respuesta.append( linea );
}
buffer.close();
The servlet then get the parameters with the method
getParameterValues().
SERVLET TO APPLET
-----------------
The communication from servlet to applet is done
with the PrintWriter of the servlet.
PrintWriter out = new PrintWriter (new
response.getOutputStream()));
out.print(aEnviar);
out.close();
I expect this example will be useful.
Jesus Escanero
_______________________________________________________________
Do You Yahoo!?
Consiga gratis su dirección @yahoo.es en http://correo.yahoo.es
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search Archives:
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]