Skip to main content

Parameters in html not passed to applet launched with jnlp

3 replies [Last post]
zamirathe
Offline
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:

javatest3.php

<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>
<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>
<p>...there is an html form below...</p>
<p>

j3dwyvern.jnlp

<br />
<?xml version="1.0" encoding="UTF-8"?></p>
<p>        codebase="http://www.zenathia.com/"<br />
        href="j3dwyvern.jnlp"></p>
<p>            J3D Wyvern Test<br />
            Zamirathe</p>
<p>            J3D Wyvern Test</p>
<p>        --></p>
<p>

Part of WyvernApplet5.java

<br />
public WyvernApplet5() {<br />
  		//for (int i = 0 ; i < args.length ; i++) {<br />
    			//filename = args[0];<br />
  		//}</p>
<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(Applet.java:174)<br />
	at WyvernApplet5.(WyvernApplet5.java:830)<br />
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)<br />
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)<br />
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)<br />
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)<br />
	at java.lang.Class.newInstance0(Class.java:355)<br />
	at java.lang.Class.newInstance(Class.java:308)<br />
	at sun.plugin2.applet.Plugin2Manager$12.run(Plugin2Manager.java:2955)<br />
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)<br />
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)<br />
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)<br />
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)<br />
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)<br />
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)<br />
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)<br />
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)<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.
interactivemesh
Offline
Joined: 2006-06-07

Hi,

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

[code]

-->
[/code]
Is there any corresponding comment start-tag '