Applet - Servlet Combination
One of
the factors to consider when deciding between implementing
the applet or servlet form of the graph is that, browsers
in general do not print applets very well and the results
can vary between browser makes and versions. The servlet however
returns the graph image to the browser in PNG format and as
such will print consistently without any problems across all
browser makes and versions.
Another
factor to consider when deciding to implement the applet or
servlet is whether the interactive features of the applet
are required (mouseover pop-ups and mouseclick URL functionality).
In the servlet form, the graph is returned to the browser
as a PNG image and as such the interactive features of the
applet are not available.
This example
demonstrates how to implement the applet and servlet together
so that all the interactive features of the applet are presented
to the user and also giving the user the option of printing
the page containing the graph.
On this
first page we implement the applet ( which acquires both the
configuration and graph data from data files). Clicking on
the note at the foot of the graph will bring up an almost
identical page which contains the servlet implementation which
is universally printable.
( for
a printable version of this page please click here )
The configuration
data is acquired from the text file pieprops.txt
(click here to view)
and the graph data is acquired from the text file piedata.txt
(click here to view).
and here
is the HTML code,
<applet code="PiechartApplet.class"
archive="Piechart.jar" width="550" height="450">
<!-- Start Up Parameters -->
<PARAM name="LOADINGMESSAGE" value="Creating
Chart - Please Wait."> <!-- Message to be displayed
on Startup -->
<PARAM name="STEXTCOLOR" value="0,0,100">
<!-- Message Text Color-->
<PARAM name="STARTUPCOLOR" value="255,255,255">
<!-- Applet Background color -->
<!-- Data files
-->
<PARAM name="chartproperties" value="pieprops.txt">
<PARAM name="chartdata" value="piedata.txt">
</applet>
For a
full explanation of and range of values for the above parameters
please see the Documentation.
Note:
If you are using the evaluation version then in the applet
a pop-up window will appear upon the startup and an evaluation
message will be incorporated by the servlet. Both these features
have been removed from the licensed version. Licensing information
can be found at http://www.jpowered.com/graph_chart/index.htm
<< back to Examples Index
<< back to Getting
Started
|