Java - Using html param elements
From Global Programming Syntax
When creating java applets, usually you will want to transfer data from the webpage to the java applet. Then can be done with the param element. Below is an example of the html code used for setting a param.
<applet code="filename.class" width="600" height="150">
<PARAM NAME="dmessage" VALUE="This is the sample text.">
</applet>
Just as a note, using NAME="text" will not work due to compatibility errors with the value of the name. However the above example should work fine. So now that the html is sorted, to display the data, below is a basic way to do it graphically:
// required when you create an applet
import java.applet.*;
// required to paint on screen
import java.awt.*;
//the below name starts the applet with the files name called 'filename'.
public class filename extends Applet
{
public void init()
{
}
public void stop()
{
// meant to be empty.
}
// The standard method that you have to use to paint things on screen
public void paint(Graphics g)
{
//in here is the paint data.
g.drawString(getParameter("lyrics"),10,20);
}
}
The main thing you will notice in that script is that the getParameter() function is used to retrieve the values. That simple.
