Keval Trivedi
Keval Trivedi

Reputation: 1300

set param value of jnlp dynamically

I am trying to launch applet using JNLP. I want to pass some parameter dynamically to applet. My JNLP file looks like

<?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://localhost:8080/WebAppTest/jar/" href="">
        <information>
            <title>JNLP Test</title>
            <vendor>Java</vendor>
        </information> 
        <resources>
            <!-- Application Resources -->
            <j2se version="1.5+" />
            <jar href="test.jar" main="true" />            
        </resources>
        <security>
            <all-permissions/>
        </security>
        <applet-desc 
             name="Test Applet"
             main-class="com.test.TestApplet.class"
             width="100"
             height="30">
             <param name="testStr" value="something" />
        </applet-desc>
        <update check="background"/>
    </jnlp>

I want to set testStr value dynamically.

Upvotes: 2

Views: 1957

Answers (1)

kakurala
kakurala

Reputation: 824

You cant get Request object in jnlp file directly, So as an alternate make jnlp as a jsp page and pass the request and response to it as shown in here - and change the content type to application/x-java-jnlp-file as they did.

one more link http://portal.krypthonas.de/2010/10/11/passing-dynamically-parameters-to-a-java-web-start-app-jnlp/ with complete code snippets.

Upvotes: 4

Related Questions