Here's my situation:
I need to keep an applet loaded, and avoid having to reload it each time the user goes to the page where the applet is embedded.
How can i achieve this? Are there any parameters to set my applet to be singleton?
Here are the parameters I'm currently using:
<object id="mockapplet" name="mockapplet"
classid="java:mockClass"
type="application/x-java-applet"
archive="#{myAppletPath}"
height="1"
width="1" codebase=".">
<param name="code" value="mockApplet" />
<param NAME="MAYSCRIPT" VALUE="true" />
<param name="archive" value="#archivePath}" />
<param name="JAVA_CODEBASE" value="." />
<font color="red">Applet error</font>
</object>
in fact i need init() method to be call only once , in my case it is call each time my page reloads.
well, if your applet is Embedded in your page, you reload it each time you reload the page ! if you want to keep parameters, you have to set a cookie.
Related
Attempting to embed a Java applet to an existing webpage. Code appears to be correct (at least as far as I understand it). However in FireFox, the applet simply doesn't show and in IE, I get a couple of different messages stating Java content has been restricted. Yes, Java is enabled in both browsers. My research suggests that the problem may be the web browsers simply blocking Java outright, due to the recent security concerns, however I really would like to double the code to make sure nothing is wrong with it.
Am I missing something with my code or is this the browsers refusing to display Java over security concerns?
Any thoughts?
<div id="links">
<!--[if IE]><!-->
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase="http://java.sun.com/update/1.6.0/jinstall-6-windows-i586.cab"
type="application/x-java-applet"
width="700" height="30">
<param name="code" value="PopMenu.class" />
<!--<![endif]-->
<!--[if !IE]><!-->
<object classid="java:PopMenu.class"
type="application/x-java-applet"
width="700" height="30">
<!--<![endif]-->
<param name=labelpos value="right" />
<param name="src0" value="button0.gif" />
<param name="src1" value="button1.gif" />
<param name="src2" value="button2.gif" />
<param name="src3" value="button3.gif" />
<param name="text0" value="Robert Frost on Wikipedia"/>
<param name="text1" value="Robert Frost at Poets.org"/>
<param name="text2" value="Robert Frost Out Loud"/>
<param name="text3" value="Robert Frost: America's Poet"/>
<param name="href0" value="http://en.wikipedia.org/wiki/Robert_Frost"/>
<param name="href1" value="http://www.poets.org/poet.php/prmPID/192"/>
<param name="href2" value="http://robertfrostoutloud.com"/>
<param name="href3" value="http://www.ketzle.com/frost"/>
</object>
</div>
EDIT
In response to the comments below; this is part of a school assignment and I have no code for the applet to post; only the .class file. It appears that I'm not the only one in class trying to figure out this issue; however the professor's only response is to write the code as the textbook teaches it. I've done that; but I still want to make sure I'm not missing something, hence why I'm asking about here.
i am embedding flash in jsp using following code so as to activate webcam but i want to read an Image from that object tag using java,jsp or jscript and want save it on to server directory
HOw can we do this?
<object id="whatever" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="282" height="180"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0">
<param name="src" value="./swf/capturecam.swf"/>
<param name="bgcolor" value="#FFFFFF"/>
<param name="quality" value="best"/>
<embed name="whatever" src="./swf/capturecam.swf" width="282" height="180" bgcolor="#FFFFFF" quality="best" pluginspage="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">
</embed>
</object>
I have an applet code like this:
<applet type="applet" codebase="." code="ViewerApplet.class" align="center" width="100%" height="600" archive="icepdf-core.jar, icepdf-viewer.jar, icepdf-applet.jar">
<param name="image" value="my_logo.gif" type="image/gif">
<param name="java_arguments" value="-Xmx128m" />
<param name="classloader_cache" value="true" />
<param name="url" value="<%=test%>" />
</applet>
I want to add style to this line. <param name="image" value="my_logo.gif" type="image/gif">
It means, before loading the pdf i have replaced the java logo with my logo.
The logo should be aligned at center with some style. Is it possible to add style to the
above param tag.
Thanks -
Haan
No, the param tags are only for sending parameters to the applet. Definition on w3c:
The 'param' tag is used to define parameters or variables for an object or applet element.
Imagine that the param tag is the same as sending a string to a function, you can't format the string by sending it in a different way.
can anyone explain to me how to cache a java applet, to speed up performance when reloading the same applet on another page or return.
You need to specify parameters within the applet's HTML object or embed tag:
http://download.oracle.com/javase/1.4.2/docs/guide/plugin/developer_guide/applet_caching.html
Does this page answer it?
<OBJECT ....>
<PARAM NAME="archive" VALUE="...">
....
<PARAM NAME="cache_option" VALUE="...">
<PARAM NAME="cache_archive" VALUE="...">
<PARAM NAME="cache_version" VALUE="...">
</OBJECT>
or
<EMBED ....
archive="..."
....
cache_option="..."
cache_archive="..."
cache_version="...">
im trying to get from applet to object so i can resolve z-index issues. The first applet tag works...my conversion to object doesn't. Can anyone point me in the right direction?
From:
<applet name='previewersGraph' codebase="http://www.mydomain.info/sub/" archive="TMApplets.jar" code='info.tm.web.applet.PreviewerStatsGraphApplet' width='446' height='291'>
<param name="background-color" value="#ffffff" />
<param name="border-color" value="#8c8cad" />
To:
<OBJECT id="previewersGraph" name="previewersGraph" classid="clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA"
width="200" height="200" align="baseline"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0">
<PARAM name="code" value="info.tm.web.applet.PreviewerStatsGraphApplet">
<PARAM name="codebase" value="http://www.mydomain.info/sub/">
<PARAM name="type" value="application/x-java-applet;jpi-version=1.4.2">
<PARAM name="archive" value="TMApplets.jar">
<PARAM name="scriptable" value="true">
No Java 2 SDK, Standard Edition v 1.4.2 support for APPLET!!
</OBJECT>
Firefox fails with a classid attribute. The below should work cross browser:-
<p>
<object type="application/x-java-applet"
name="previewersGraph" width="446" height="291">
<param name="codebase" value="http://www.mydomain.info/sub/" />
<param name="code" value="info.tm.web.applet.PreviewerStatsGraphApplet" />
<param name="archive" value="TMApplets.jar" />
<param name="scriptable" value="true" />
<param name="mayscript" value="true" />
<param name="background-color" value="#ffffff" />
<param name="border-color" value="#8c8cad" />
</object>
</p>
In my tests both IE8 and FF5 required the "type" attribute. The mayscript param is only required for Java plugins before 1.6.0.10. The scriptable param is still required according to javadocs 1.6.0.21. In a test with 1.6.0.24 for a signed applet, IE8 called it OK from JS without scriptable being set true.
The HtmlConverter tool in the jdk/bin directory should help you to create the Object tag (at least with an old version of Java).
Now Sun (euh Oracle) recommends the applet tag and even jnlp. Look at the deployJava.js script.
I don't think changing it to object will fixed your problem as the applet will be still be paint above the HTML.
Why you do not use deployment toolkit ? It would save you a lot of trying - see http://rostislav-matl.blogspot.com/2011/10/java-applets-building-with-maven.html for more info.