I am just looking for a bit of sound advice before I start developing my application. In essence what I am trying to do is quite simple. I have a whole stack of tables stored in a database and I want to display the results of (SQL) queries in a Web-based application in a variety of different graphical formats, i.e. line graphs, pie-charts, bar-charts (standard enough formats - nothing too fancy), etc.
I did a little research on the Web and came across JSP and JASPER Reports which I know absolutely nothing about but appear to be relatively straighforward and some of the better tools to use for this kind of thing. I am quite familiar with Java in general so I assume that this would help a lot.
Can anybody give me some useful pointers as to whether JSP and JASPER are the best choice of tools for generating graphs from database tables and displaying them in Web-based formats. Also, I assume that one would connect to the database using JDBC or does JSP use its own syntax for establishing connections?
Thanks for your help
[BPSouther: Added a meaningful subject line] [ November 10, 2008: Message edited by: Ben Souther ]
Yes, you would use JDBC, but you should not embed that code in JSPs (that's considered bad design) - use a JSP backing bean instead. See chapter 14 of this introduction for more details.
As to the charts, Jasper is more of a reporting tool. It can create charts, but it's designed to do much more than that, so if all you need is to embed chart images in web pages, then it may not be the best option.
My favorite way to create charts in web pages is the cewolf library (which these days I'm involved in maintaining). See my signature for a link to it.
Apologies for the uninformative topic title! It won't happen again.
Just to clarify a few issues I still have regarding my original post. My overall application would be developed using different aspects of Java.
In other words I would first use JDBC to (1) connect to the database, (2) imbed SQL queries to retrieve the relevant data, and (3) manipulate the resultset.
I would then use Jasper/cewolf depending on my specific requirements to generate different styles of graphs/charts based on the resultset produced? The graphs would need to be generated in different formats, i.e. pdf, jpeg, tiff, etc. and then inserted into Web pages, pdf documents, etc. (I have not totally decided how the output will be presented at this point).
Do I need to use JSP at all if I decide to use cewolf? Where might the JSP fit in?
Thanks a lot for your help
Joined: Mar 22, 2005
It sounds as if Jasper is not really appropriate at all. It's a reporting tool, and used to describe complete reports that include text, images, formatting, data etc.
cewolf is a JSP tag library, so it's the tool of choice if you want to create web pages (using JSP) that contain chart images. If you need the chart images in other contexts and formats as well, then it might not be suited so well.
A useful library for creating chart images is JFreeChart (which is actually what's used by cewolf underneath). An example of its use is at http://faq.javaranch.com/java/JFreeChartDemo It can export JPEG and PNG, and could be extended to create GIF and TIFF as well with some additional programming.
Creating PDFs from various image formats can be done by the excellent iText library; see here for further information.