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. In addition the
results can vary between browser makes and versions.
The
servlet however returns the graph image to the browser in
PNG Image 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 an image and as such the interactive features of the
applet are not available.
If both
the ability to print and the interactive features are required
then it is possible to implement both the applet and servlet
which work from the same datasources. In this case the following
solution is recommended,
Step
1 - Create your html page which contains the applet
version of the graph, with all the interactive features,
configuring the applet to receive the data from either
files, server side scripts or databases.
Step
2 - Create a copy of this page, replacing the applet
implementation with the servlet ( <IMG> tag ), using
exactly the same data sources as with the applet.
Step
3 - On the applet page, place a little text footnote
at the bottom of the applet which says something like,
"For
a printable version of this page please click here".
Then
hyperlink, this text, to the page created in Step 2.
In this
manor the page created in Step 1 will be your main
page with which your visitors will enjoy all the interactive
features of the applet. If a visitor does wish to print
the graph, then by clicking on the text, the almost identical
page created in Step 2 will be displayed. This will
contain the graph in PNG Image format and hence be universally
printable.
For
an example of this please click
here.