Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
Implementing Graphing Servlets

Implementing Graphing Servlets

Ratings: (0)|Views: 91 |Likes:
Published by boobathi2006

More info:

Published by: boobathi2006 on Jul 01, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

06/30/2009

pdf

text

original

 
Implementing Graphing Servlets
Overview
Each graph style is available as a Java Servlet. The ./ServletFiles/ directory of the downloadedpackage contains the class files for each graph style.(
)The Servlet Graphs operate on the Web Server within a Servlet Engine (eg. Tomcat, WebSphere,WebLogic, JRun etc). A graph is added to a page via the standard HTML IMG tag where SRC elementis set to the URL of the graphing servlets. When the page is viewed the browser will send therequest for the graph to the web server which, in turn, will pass the request to the Servlet Engineand the graphing servlet. The graphing servlet will then dynamically construct the graph imagewhich is then returned back to the browser where it is displayed to the user.
Web Server Requirements
The web server will need to have a Servlet Engine set-up and installed in order to operate thegraphing servlets (eg. Tomcat, WebSphere, WebLogic, JRun etc).There are no special requirements on the client browser
Set Up and Implementing Procedure
A graph servlet can be added to a web page with the following steps:-
 
 
 
Add the Servlet IMG tag into an HTML pageStep 1 - Install the Graphing Servlets in the Servlet Engine
This procedure may vary slightly between different Servlet Engines and as such you may also need to refer to your SerEngine's documentation.With most modern Servlet Engines the Graphing Servlet class files will need to be installed as a web application. Thegraphing servlets have been built within the package jpowered.graphs which can be found in the ./ServletFiles/ directoThe following describes how the JPowered Graphing package would be added to Tomcat 5.5.a) Under the ./webapps/ directory of the Tomcat installation create this directory structure:-
./webapps/jpowered/WEB-INF/classes/
b) From the ./ServletFiles/ directory of the downloaded package copy the ./jpowered/ directory and all it's contents to t./webapps/jpowered/WEB-INF/classes/ created in the previous step.c) From the ./ServletFiles/ directory of the downloaded package copy the web.xml file and place this in the./webapps/jpowered/WEB-INF/ directory of Tomcat.d) Restart Tomcat
Step 2 - Set up the Configuration data
The graphing servlets provide the following two options for inputting the configuration data.
a) with a Configuration File.
 
The servlet will read all the configuration parameters from a specified file. To use this option incorporate the URL of thconfiguration file into the IMG tag (see Step 4).Click on the following to view an example property file for each chart style:-
As you will see from the example file each property is specified on a name, value basis. Adjust the property values tospecify the characteristics of the graph and then place this file in the same directory as your web page.A full description of each property can be found in the appropriate parameter reference:-
This option allows the graph servlets to obtain all the configuration data from another server side application. The servside script should be designed to output the configuration data in the same format as the file in option a) above.For example scripts see the ./ServerTemplateScripts/ directory of the downloaded package.For a more in depth look at this process also see the
With most implementations supplying the configuration data either from a data file will be the most efficient, howevesupplying this data via a server side script is useful where the graph properties need to be dynamically calculated. eg.dynamic axis labelling.
Step 3 - Set up the Graph data
As with the configuration data there are two options for supplying the data values to the servlet
a) with a Data File.
The servlet will read all the data from a specified file. To use this option incorporate the URL of the data file into the IMtag (see Step 4). Click on the following to view an example data file:-
As you will see from the example file each piece of data is specified on a name, value basis. The first element of each lirepresents the data name (specifying the series and data order) and then the value.For more information on the data format see
 
b) Server Side process
This option is the most powerful and gives the servlet the ability to retrieve data from databases. This method involve
 
specifying a server side script in the IMG tag of the html page (see Step 4) which in turn returns the data to the grapservlet. This provides enormous flexibility for data acquisition. The server side script can be constructed in the languageyour choice (eg. PHP, JSP, ASP etc) and as such can be written to acquire data from the widest variety of sources, multidatabases etc.To instruct the servlet to retrieve data from a server side script simply add the URL of your server side script into the Itag of the HTML page (see Step 4). The server side script should be designed to output the data in the same format asfile in option a) above.For example scripts see the ./ServerTemplateScripts/ directory of the downloaded package.For a more in depth look at this process also see the
TutorialsStep 4 - Incorporate the Servlet IMG tag into the HTML page
The final step is to incorporate the graph into the HTML page. This is done via the standard html IMG tag.
<img src="[ServletEngineURL]/jpowered/servlet/jpowered.graphs.[GRAPHSERVLETNAME]?config=[URLconfigFile]&data=[URLdataFile]"width="500" height="420">
Where,
[GRAPHSERVLETNAME]
- should be replaced with one of the following:-
LineGraphServlet
AreaGraphServlet
PiechartServlet
SVbarchartServlet
VbarchartServlet
HbarchartServlet
SHbarchartServlet
[ServletEngineURL]
- should be replaced with the URL of the servlet engine. This can vary depending upon the servlengine's configuration. For example with the standard install of Tomcat this may be:-http://localhost:8080/jpowered/servlet/( the port number may also vary )
[URLconfigFile]
- should be replaced with the URL to either a Configuration file or server side process.
[URLdataFile]
- should be replaced with he URL to either a Data file or server side process.For example, to produce a line graph with the following,Servlet Engine URL = http://www.yourdomain.com/Configuration File URL = http://www.yourdomain.com/config.txtData Servlet = dataservlet.classproducing a graph image of 400 pixels by 300 pixels, the following IMG tag would be incorporated into the html page
<img src="http://www.yourdomain.com/jpowered/servlet/jpowered.graphs.LineGraphServlet?config=http://www.yourdomain.com/config.txt&data=http://www.yourdomain.com/servlet/dataservlet" width="400" height="300">

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->