value passing in java applet - java

i am passing value in java applet but value is coming there as null
my javascript for applet deployment :
<script src="javascript/deployJava.js"></script>
<script>
var attributes = { id:'dynamictreeapplet', code:'jstojava.com.vaannila.utility.dynamicTreeApplet.class',width:1000,height:1000} ;
var parameters = {jnlp_href:'./appletjars/a.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
My jnlp
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/docRuleToolProtocol/appletjars/" href="a.jnlp">
<information>
<title>dynamictree</title>
<vendor>Ashutosh</vendor>
</information>
<resources>
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="dynamictree.jar" main="true" />
<jar href="prefuse.jar" main="true" />
</resources>
javascript to pass value :
function showSelected(value){
alert("the value given from"+value);
var diseasename=value;
alert(diseasename);
dynamictreeapplet.dieasenameencode=diseasename;
}
<applet-desc name="dynamictree" main-class="com.vaannila.utility.dynamicTreeApplet" width="500" height="500">
</applet-desc>
</jnlp>

Change
dynamictreeapplet.dieasenameencode=diseasename;
to
document.dynamictreeapplet.dieasenameencode=diseasename;
and probably dieasenameencode to diseasenameencode .

Related

Java Web Start - jnlp database connection

My JavaWebStart(using Netbeans) application deploys and functions very well on the apache webserver(localhost), BUT when I connect it to its mysql DB, it only deploys but doesnt function. However, it is connecting very well in Netbeans.
I have tried signing in the jar files using 'keytool' but cmd cannot recognize 'keytool' either.
How do I connect this app to its database?
The JNLP:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="http://192.168.0.10/JWS2" href="launch.jnlp" spec="1.0+">
<information>
<title>JavaWebStart2</title>
<vendor>Administrator</vendor>
<homepage href=""/>
<description>JavaWebStart2</description>
<description kind="short">JavaWebStart2</description>
<offline-allowed/>
</information>
<update check="background"/>
<resources>
<j2se version="1.8+"/>
<jar href="JavaWebStart2.jar" main="true"/>
<jar href="lib/mysql-connector-java-5.1.18.jar"/>
</resources>
<application-desc main-class="main.NewJFrame">
</application-desc>
</jnlp>
HTML:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test page for launching the application via JNLP</title>
</head>
<body>
<h3>Test page for launching the application via JNLP</h3>
Launch the application
<script src="http://java.com/js/deployJava.js"></script>
<script>
deployJava.createWebStartLaunchButton("launch.jnlp")
</script>
<!-- Or use the following link element to launch with the application --
>
<!--
-->
</body>
</html>

Browser ignore my JVM parameters in JNLP

I try to test the JVM parameters with this JNLP file :
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>Test Applet</title>
<vendor>D2D - Architecture - Composants</vendor>
</information>
<resources>
<!-- Application Resources -->
<!--<j2se version="1.7*" href="" java-vm-args="-ea -Xincgc -verbose -Xmx768m" />-->
<j2se version="1.6*" href="" initial-heap-size="512" max-heap-size="1024M" />
<jar href="Applet.jar" main="true" />
<!-- Si plusieurs jars : mettre plusieurs balises jar -->
</resources>
<applet-desc
name="Test Applet"
main-class="TestApplet"
width="600"
height="300">
</applet-desc>
<update check="always"/>
</jnlp>
When i launch the "jnlp", it taking in the account this but when i launch from a html page with this script :
<body>
<h1>Prototype Applet JRE</h1>
<!-- Script JavaScript pour le déploiement de l'applet -->
<script src="javaScript/deployJava.js"></script>
<!-- Les différentes informations sur l'applet -->
<script>
var attributes = { code:'TestApplet.class', archive:'Applet.jar'} ;
var parameters = {jnlp_href: 'applet.jnlp'} ;
deployJava.runApplet(attributes, parameters, '1.6');
</script>
</body>
The browser ignores this JVM parameters and launch the applet normally...but the jvm has "512" at the min...
I search a lot, test a lot, without results...
Test environment :
Browsers : Chrome 26.0.1410.43 m , IE 8.0.6..
JRE : 1.6.0_u22 / 1.7
Thanks for help!

Javafx 2.0 when Applet Security prompt, How to Customize the Background of empty Applet area?

I have a Javafx 2.0 Applet working well. This applet requires all security permissions. This applet has a Light Grey background (same color as html background page).
So my problem is: when Java security requests the user to allow the applet, the background of the unload-yet-applet is dark grey. When the user clicks on "Execute", the background becomes Light Grey as wanted. But this is because the applet is loaded.
I want this empty applet area to be Light Grey (as the background of the html page) when this Security warning pops up. Do you guys have an idea how to do this?
I'm using a preloader with a full rectangle filled with Light Grey, but the preloader seems to be launched after Java security all permissions allowed by the user.
Here the result to let you better understand:
HTML file without the stylesheet css (same problem if I remove the css):
<html><head>
<SCRIPT src="./web-files/dtjava.js"></SCRIPT>
<script>
function javafxEmbed() {
dtjava.embed(
{
url : 'Test.jnlp',
placeholder : 'app-placeholder',
width : 600,
height : 400
},
{
javafx : '2.0+'
},
{}
);
}
dtjava.addOnloadCallback(javafxEmbed);
</script>
</head><body>
<h2>Test page for <b>TEST</b></h2>
<center><div id='app-placeholder'></div></center>
</body></html>
And this is the JNLP file:
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="Test.jnlp">
<information>
<title>Test</title>
<vendor>Test</vendor>
<homepage href="http://www.test.com/"/>
<description>I don't know where this appears</description>
<description kind="short">And I don't know where this appears too</description>
<icon href="icon.png"/>
<icon kind="splash" href="icon.png"/>
<offline-allowed/>
</information>
<resources os="Windows">
<jfx:javafx-runtime version="2.0+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
</resources>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="lib/test-Preloader.jar" size="5096" download="progress" />
<jar href="test.jar" size="246346" download="eager" />
</resources>
<security>
<all-permissions/>
</security>
<applet-desc width="600" height="400" main-class="com.javafx.main.NoJavaFXFallback" name="Test" />
<jfx:javafx-desc width="600" height="400" main-class="testApp.IM" name="Test" preloader-class="test.preloader.im_Preloader">
</jfx:javafx-desc>
<update check="background"/>
</jnlp>
See the Loading Screen section of the Applet Deployment guide.
The new plug-in offers better customization of the image which is displayed before the applet is loaded. Animated GIFs are now supported as the target of the image parameter, as described in the Special Attributes section of the old Java Plug-In Guide. Additionally, the following new parameters are now supported: ...

web start creating xml with out of date meta description

I am new to java Web Start and trying to set up a jnlp download on my server.
The Web start seems to initiate ok, butit gives the following error:
WARNING: <meta> tag is not closed correctly Exception parsing xml at line 3
Line 3 just contains the meta descriptions. Originally I used some characters the xml parse might object to, these were "-" and "(" ")". Suspecting that these characters might not be valid in a meta description, I removed them from the meta on my web page and in the jnlp script.
However, when I try to run Web start, it still has line 3 as:
<head><title>xxxxxx</title><meta name="author" content="xxxxx"><meta name="keywords" content="xxxxxx xxxxxxxx xxxxxxxxx"><meta name="description" content="xxxx (xxx) xxxxx, xxxx, 2-12 players."></head>
In other words it is not showing my updated meta info. Where is it getting this old version from, and how can I update it?
And most importantly, are the characters "- ( ) ," causing my problem anyway?
Here is a link to my site. Be aware it's not quite ready to go live yet!
fantasyhexwars.com/getting_started.html
Quite possibly something is configured wrong!
It seems so.
http://fantasyhexwars.com/include/launch.jnlp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html lang="en">
<head><title>Fantasy Hex Wars</title><meta name="author" content="Mark Keen"><meta name="keywords" content="strategy fantasy hex wars multiplayer war game turn based"><meta name="description" content="An online, turn-based, strategy game for up to 12 players."><link rel="shortcut icon" href="http://91.223.16.102/httpdocs/favicon.ico"></head>
<frameset rows="100%,*">
<frame title="http://91.223.16.102/include/launch.jnlp" src="http://91.223.16.102/include/launch.jnlp" name="mainframe" frameborder="0" noresize="noresize" scrolling="auto">
<frame title="empty frame" frameborder="0" scrolling="no" noresize="noresize">
<noframes>Sorry, you don"t appear to have frame support.
Go here instead - Fantasy Hex Wars</noframes>
</frameset>
</html>
http://91.223.16.102/include/launch.jnlp
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="http://fantasyhexwars.com/httpdocs/include" href="launch.jnlp" spec="1.0+">
<information>
<title>Fantasy Hex Wars</title>
<vendor>Fysh Games</vendor>
<homepage href="fantasyhexwars.com"/>
<description>A turn-based, online, multiplayer strategy game.</description>
<description kind="short">Fantasy Hex Wars</description>
</information>
<update check="always"/>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+"/>
<jar href="FantasyHexWar.jar" main="true"/>
<jar href="lib/appframework-1.0.3.jar"/>
<jar href="lib/swing-worker-1.1.jar"/>
<jar href="lib/beansbinding-1.2.1.jar"/>
<jar href="lib/mail.jar"/>
</resources>
<application-desc main-class="fantasyhexwar.FantasyHexWarApp">
</application-desc>
</jnlp>

How to specify applet libraries in JNLP file

I'm trying to deploy an applet using JNLP. The file structure is thus:
/
dbstats.html
dbstats.jnlp
dbstats.jar
lib/
substance.jar
trident.jar
guava-0.7.jar
Here's my HTML:
<html>
<head>
<title>Dreambearstatistieken</title>
<script src="http://www.java.com/js/deployJava.js"></script>
<script type="text/javascript">
var attributes = {
code:'dreambear.stats.viewer.DBStatsViewer',
width:900, height:600
};
var parameters = {jnlp_href: "dbstats.jnlp"};
var version = "1.6";
</script>
</head>
<body>
<script type="text/javascript">
deployJava.runApplet(attributes, parameters, version);
</script>
</body>
</html>
And the JNLP file:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
<information>
<title>Dreambearstatistieken</title>
<vendor>Weber</vendor>
</information>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
<jar href="lib/trident.jar" />
<jar href="lib/substance.jar" />
<jar href="lib/guava-r07.jar" />
<jar href="dbstats.jar" main="true" />
</resources>
<applet-desc
name="Dreambearstatistieken"
main-class="dreambear.stats.viewer.DBStatsViewer"
width="900"
height="600">
</applet-desc>
<update check="background" />
</jnlp>
As far as I can see, everything should be ok, but it's not. I get a ClassNotFoundException on org.pushingpixels.substance.api.skin.SubstanceNebulaLookAndFeel, which is in substance.jar. What am I doing wrong?
And wider, is there a good tutorial or book about using applets and JNLP in the 2010s?
First your codebase is empty. As far as I remember it should contain the absolute path to your application. Probably I am wrong but start from this. If it helps but you wish to reuse the jnlp file try codebase="." (although I am not sure it is legal.)
Next, try to download one of the jars under lib directory using browser. It is needed to be sure that this directory is accessible.
Good luck!
You have to put the jlnp's name on href="" as well. Do it like this:
<jnlp spec="1.0+" codebase="http://mydomain:5500/myapp" href="dbstats.jnlp">

Categories

Resources