Forum Stats

  • 3,852,528 Users
  • 2,264,112 Discussions


Dynamic JNLP and ADF application

793149 Member Posts: 131
edited Nov 10, 2016 7:02AM in JDeveloper and ADF

Hi Everyone,

We use JDeveloper and weblogic server 10.3.6. Our ADF application uses applet to connect to the user's scanner to scan and upload the images. This applet has parameters that is passed in order to show the reference while scanning. Now we are in a process of moving the applet to JNLP as the browser are desupporting NPAPI plugins. Can somebody let me know if there is any preferred way of doing this?

Right now I have created a jsp file(to create dynamic jnlp as the parameter values to be passed to the applet/jnlp should be dynamic) in ADF application workspace and set the content type of the page to application/x-java-jnlp-file. I am not able to evaluate the expression for the parameters except the values in implicit objects. Any help is much appreciated.


V. Praveen

MohiEldin Mohamed


  • 793149
    793149 Member Posts: 131
    edited Oct 12, 2016 6:00AM

    Hi Everyone,

    Is there anything that anyone of you can share please?


    V. Praveen

  • 793149
    793149 Member Posts: 131
    edited Oct 14, 2016 2:16AM

    Hi All,

    It is much appreciated if someone can give any insights in to it.

  • Shemeer
    Shemeer Member Posts: 119 Bronze Badge
    edited Oct 14, 2016 8:37AM

    Did you try this from java script?

  • 793149
    793149 Member Posts: 131
    edited Oct 17, 2016 5:47AM

    Hi Shemeer,

    Thanks for responding. I haven't tried it through javascript. Do you have any reference for it so that I can follow to implement?


    V. Praveen

  • 793149
    793149 Member Posts: 131
    edited Nov 10, 2016 7:00AM

    Hi All,

    I could not get it done when it is an applet. However, I found an alternative solution by three steps and thought i should share this:

    1. Convert the applet into a plain java application.

    2. Add an action component to your page and add fileDownloadActionListener

    3. Generate JNLP using the method attribute of fileDownloadActionListener.

    Let us see them in detail

    For point number 1,

    I converted my applet into a java program by simply adding some attributes(to hold the values passed as arguments) and main() method as follows

      public static void main(String[] args)


        MyApplet applet = new MyApplet();

        applet.setUrl(args[0]);// Make sure that you have an attribute named url in the class and have accessors

        applet.setInvoiceName(args[1]);// Make sure that you have an attribute named invoiceName in the class and have accessors


        JFrame frame = new JFrame();

        frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );

        frame.getContentPane().add(applet, BorderLayout.CENTER);

        frame.setTitle("Scan your document");



        frame.setSize(893, 510);

        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

        Dimension frameSize = frame.getSize();

        frame.setLocation((d.width-frameSize.width)/2, (d.height-frameSize.height)/2);



    For point 2,

    Make sure that fileDownloadActionListener has contentType set to application/x-java-jnlp-file. Please take a look at the following code:

    <af:commandLink id="commlink12" partialSubmit="true"

                    shortDesc="Invoker" text="Invoker">

      <af:fileDownloadActionListener contentType="application/x-java-jnlp-file"



    For point 3,

    Generate the JNLP dynamically in the backing bean. The following code is just a model to let know how it can be done.

      public void generateJnlp(FacesContext facesContext,

                               OutputStream outputStream) throws IOException


        String invoiceNameToBePassed = null;

        String urlToBePassed = null;

      //logic to get the data and it can be of anything as per your requirement, I have just used the current row details for demo purpose

        MyInvoiceViewRowImpl currentRow = (MyInvoiceViewRowImpl)myAppModule.getMyInvoiceView1().getCurrentRow();

      invoiceNameToBePassed = currentRow.getAttribute("InvoiceName").toString();

        urlToBePassed = currentRow.getAttribute("TargetUrl").toString();


        StringBuffer sb = new StringBuffer();

        String xmlEnc         = "<?xml version='1.0' encoding='UTF-8'?>\n";

        String jnlpRoot       = "<jnlp spec=\"1.0+\" href=\"\" codebase=\""+codeBaseUrl+"\">\n";//string value of codebase to be added above

        String jnlpInforStart = "  <information>\n";

        String jnlpTitle      = "    <title>Invoker App</title>\n";

        String jnlpVendor     = "    <vendor>iVend</vendor>\n";

        String jnlpInforEnd   = "  </information>\n";

        String jnlpResources  = "  <resources>\n"+

                                "    <j2se version=\"1.6+\" />\n"+

                                "    <jar href=\"myRequiredJar1.jar\"/>\n"+

                                "    <jar href=\"myRequiredJar2.jar\" />\n"+

                                "  </resources>\n";

        String jnlpSecurity   = "  <security>\n"+

                                "    <all-permissions/>\n"+

                                "  </security>\n";

        String jnlpApp        = "  <application-desc name=\"Invoker App\" width=\"873\" height=\"540\"\n" +

                                "  main-class=\"com.test.MyApplet\">\n" +

                                "    <argument>"+invoiceNameToBePassed+"</argument>\n" +

                                "    <argument>"+urlToBePassed+"</argument>\n" +  

                                "  </application-desc>\n";

        String jnlpFoot       = "</jnlp>\n";












"The JNLP file generated is\n"+sb);


        byte[] bytes =sb.toString().getBytes();





    V. Praveen

    MohiEldin Mohamed
This discussion has been closed.