Comunicacion entre jsp y applets
¿Es posible que se mande informaci贸n desde un applet al jsp o a objetos de un jsp que contiene ese applet?
Trato de enviar informaci贸n del applet al jsp que lo contiene y no veo la forma.
Muchas gracias
Trato de enviar informaci贸n del applet al jsp que lo contiene y no veo la forma.
Muchas gracias
Ah铆 va un ejemplo que env铆a informaci贸n de un formulario:
String protocol=getCodeBase().getProtocol();
String host=getCodeBase().getHost();
int port=getCodeBase().getPort();
String uriServlet="tuUrl.jsp";
URL nextUrl=new URL(protocol,host,port,uriServlet);
URLConnection connection=nextUrl.openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
ByteArrayOutputStream flow=new ByteArrayOutputStream(512);
PrintWriter out=new PrintWriter(flow,true);
String datos="parametro1=valor1¶metro2=valor2";
out.print(datos);
out.flush();
connection.setRequestProperty("Content-Length", String.valueOf(flow.size()));
connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
flow.writeTo(connection.getOutputStream());
String protocol=getCodeBase().getProtocol();
String host=getCodeBase().getHost();
int port=getCodeBase().getPort();
String uriServlet="tuUrl.jsp";
URL nextUrl=new URL(protocol,host,port,uriServlet);
URLConnection connection=nextUrl.openConnection();
connection.setUseCaches(false);
connection.setDoOutput(true);
ByteArrayOutputStream flow=new ByteArrayOutputStream(512);
PrintWriter out=new PrintWriter(flow,true);
String datos="parametro1=valor1¶metro2=valor2";
out.print(datos);
out.flush();
connection.setRequestProperty("Content-Length", String.valueOf(flow.size()));
connection.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
flow.writeTo(connection.getOutputStream());