Upload files

Hi all,

I have a servlet that returns a HTML page with an applet in it. The problem is: how do I make the servlet upload the .cab archive my applet uses?

Here is the code:

response.setContentType("text/html");

PrintWriter out = new PrintWriter(response.getOutputStream());

out.println("<HTML><script>");

out.println("function confirmaProcurador(){");

out.println("var strSessao = \"" + strSessao + "\";");

out.println("var strProcurador = \"" + strHabilitado + "\";");

out.println("if (AppletGeraCertificado.isActive() == true){");

out.println("AppletGeraCertificado.setSessao(strSessao);");

out.println("AppletGeraCertificado.confirmaHabilitacaoProcurador(strProcurador);}");

out.println("return true;}");

out.println("</script><BODY>");

out.println("<APPLET ID = \"AppletGeraCertificado\"");

out.println("class = \"AppletGeraCertificado\"");

out.println("CODEBASE = \".\"");

out.println("CODE = \"com.msa.interfaceusuario.AppletGeraCertificado.class\"");

out.println("NAME = \"AppletGeraCertificado\"");

out.println("WIDTH = 0 HEIGHT = 0 MAYSCRIPT>");

out.println("<PARAM NAME=\"cabbase\" VALUE=\"framework.cab\">");

out.println("<PARAM NAME=\"diretorio\" VALUE=\"BANESTES\"></APPLET>");

out.println("<form name=\"formConfirmaProcurador\">");

out.println("<input type=\"button\" value=\"Confirma Habilitacao\" onclick=\"confirmaProcurador()\">");

out.println("</form></BODY></HTML>");

out.close();

Im using JRun 3.1 with IIS 5.0

Thanks,

J. Leroy

[1707 byte] By [juleroy] at [2007-9-26 6:42:11]
# 1

Hi

If I have understood you correctly you are trying to put code into

html file which would ensure that when the applet is loaded it would download the .cab (IE) file automatically .

To make your HTML file , browser independent you would have to use OBJECT and EMBED tags to direct the browser to retrieve the cab file for you. The OBJECT Tag is recognized by IE and the EMBED tag by Netscape. The trick however is in placing EMBED tag within the COMMENT tag which only IE can recognize - so it ignores the EMBED tag

Netscape does not recognize the COMMENT tag but can recognize the EMBED tag. This way your html file would be browser independent.

A good place to start off would be is:

http://java.sun.com/products/plugin/1.3/docs/tags.html

Keep me posted on your progress.

Good Luck!

Eshwar Rao

Developer Technical Support

Sun microsystems Inc.

http://www.sun.com/developers/support

Eshwar_indts at 2007-7-1 16:01:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thanks for your help, but the url you pointed shows how to use OBJECT tag only for Java Plugin.Do you have another example?
juleroy at 2007-7-1 16:01:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Check out site: http://developer.netscape.com/docs/manuals/htmlguid/tags14.htmSite has information on the EMBED tag. Good Luck!Eshwar RaoDeveloper Technical SupportSun microsystems Inc. http://www.sun.com/developers/support
Eshwar_indts at 2007-7-1 16:01:46 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...