Though many Java developers choose to use a series of JavaServer Pages
(JSP) to generate user interfaces in the form of several Web pages, a
single Java applet can provide an interface to the person using your
application. The problem with applets is, the syntax for embedding them
varies among browsers. If you have to support a population of users that
has a variety of browsers, you need to find a way to generate <EMBED>
tags for Netscape Navigator and <OBJECT> tags for Microsoft Internet
Explorer.
One way to do this is with JavaScript. You can examine various aspects
of the Document Object Model (DOM) with JavaScript code, and generate
the appropriate tags inside JavaScript IF statements. Alternately, you
can use a JSP to generate the HTML you require, and have the jsp:plugin
tag figure out the required tag for you.
<jsp:plugin type=applet code="Llamas">
<jsp:params>
<jsp:param name="furType" value="fluffy"/>
</jsp:params>
</jsp:plugin>
That says, "When generating HTML to be fed to the browser, create an
EMBED or OBJECT tag as appropriate and refer it to an applet called
Llamas with parameter 'furType=fluffy'." Therefore, we get the following
in Netscape Navigator at interpretation time:
<EMBED type="application/x-java-applet" code="Llamas"
furType="fluffy">
Again, JavaScript would do the same thing, but this is easier if you're
comfortable with JSP.