Skip to main content

Parameters in html not passed to applet launched with jnlp

3 replies [Last post]
Joined: 2010-07-28

First of all, I'm sorry if I posted this in the wrong forum. I looked but couldn't find any applet or jnlp forums.

I am having a bit of a problem. I am trying to pass 8 parameters to my 3D applet, but I keep getting a null exception when I call this.getParameter("firstparamname"). As far as I can tell, the parameters themselves are not getting sent to the applet that is being launched by jnlp. I tried to create a dynamic jnlp with php, which tries to load the applet (though I still get a null exception on the same line) if you go to it directly. If it is linked to in the applet tag, I get an error saying there is no tag in the page.

Some of my code:


<br />
<?php<br />
// This is a test of the Java 3D applet.<br />
$submit = $_POST['submit'];<br />
if ($submit) {<br />
	$dtype = $_POST['dtype'];<br />
	$mhc = $_POST['mhc'];<br />
	$shc = $_POST['shc'];<br />
	$hc = $_POST['hc'];<br />
	$ec = $_POST['ec'];<br />
	$horns = $_POST['horns'];<br />
	$curled = $_POST['curled'];<br />
	$mane = $_POST['mane'];<br />
}<br />
<p>        Java 3D Dragon Test</p>
<p>	Java 3D Dragon Test<br />
	<?php if ($submit) { ?></p>
<p>	    "/><br />
	    "/><br />
	    "/><br />
	    "/><br />
	    "/><br />
	    "/><br />
	    "/><br />
<p>...there is an html form below...</p>


<br />
<?xml version="1.0" encoding="UTF-8"?></p>
<p>        codebase=""<br />
<p>            J3D Wyvern Test<br />
<p>            J3D Wyvern Test</p>
<p>        --></p>

Part of

<br />
public WyvernApplet5() {<br />
  		//for (int i = 0 ; i < args.length ; i++) {<br />
    			//filename = args[0];<br />
<p>		mhc = this.getParameter("mhc"); <-- line 830<br />
		shc = this.getParameter("shc");<br />
		hc = this.getParameter("hc");<br />
		ec = this.getParameter("ec");<br />
		mc = this.getParameter("mc");<br />
		String dtype = this.getParameter("dtype");<br />
		String hornspara = this.getParameter("horns");<br />
		String curledpara = this.getParameter("curled");<br />
		String manepara = this.getParameter("mane");<br />
...<br />

The variables that are not initialized in this function, are initialized as private String at the beginning of the class.

The error I get when trying to load this is:

<br />
Caused by: java.lang.NullPointerException<br />
	at java.applet.Applet.getParameter(<br />
	at WyvernApplet5.(<br />
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br />
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(<br />
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(<br />
	at java.lang.reflect.Constructor.newInstance(<br />
	at java.lang.Class.newInstance0(<br />
	at java.lang.Class.newInstance(<br />
	at sun.plugin2.applet.Plugin2Manager$<br />
	at java.awt.event.InvocationEvent.dispatch(<br />
	at java.awt.EventQueue.dispatchEvent(<br />
	at java.awt.EventDispatchThread.pumpOneEventForFilters(<br />
	at java.awt.EventDispatchThread.pumpEventsForFilter(<br />
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(<br />
	at java.awt.EventDispatchThread.pumpEvents(<br />
	at java.awt.EventDispatchThread.pumpEvents(<br />
	at<br />
Exception: java.lang.reflect.InvocationTargetException<br />

Can anyone explain what I am doing wrong?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-06-07


as I'm not that familiar with php I would like to know what the meaning of the comment end-tag '-->' is in


Is there any corresponding comment start-tag '