Nbento Nbento - 8 months ago 55
Javascript Question

Javascript args on parameters in runApplet method

I need to put arguments in a Applet but i must use the deployJava library js.

My code is:

var attributes = {id : "GenericDiv", code: namespace, width:200, height:200};
var parameters = {args: "{'eventHandler':'fingerprint'}", jnlp_href:'/xxx.jnlp' };
var version = '1.6' ;
deployJava.runApplet(attributes, parameters, version);

But the code doesn't work, the javascript haven't attachs the fingerprint.

Thanks all ;)


Specifying an Applet's Input Parameters

You can specify an applet's input parameters in the applet's Java Network Launch Protocol (JNLP) file or in the element of the <applet> tag. It is usually better to specify the parameters in the applet's JNLP file so that the parameters can be supplied consistently even if the applet is deployed on multiple web pages. If the applet's parameters will vary by web page, then you should specify the parameters in the <parameter> element of the <applet> tag.

The example on that page shows two different ways to define the applet parameters:

Consider an applet that takes three parameters. The paramStr and paramInt parameters are specified in the applet's JNLP file, applettakesparams.jnlp.

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
    <!-- ... -->
         name="Applet Takes Params"
             <param name="paramStr"
             <param name="paramInt" value="22"/>
     <!-- ... -->

The paramOutsideJNLPFile parameter is specified in the parameters variable passed to the Deployment Toolkit script's runApplet function in AppletPage.html.

    <title>Applet Takes Params</title>
    <meta http-equiv="Content-Type" content="text/html;
    <h1>Applet Takes Params</h1>

        var attributes = { code:'AppletTakesParams.class',
            width:800, height:50 };
        var parameters = {jnlp_href: 'applettakesparams.jnlp',
            paramOutsideJNLPFile: 'fooOutsideJNLP' };
        deployJava.runApplet(attributes, parameters, '1.7');


Source Defining and Using Applet Parameters.