Hi all,

I am implenting a small graphing application.  It reads data from a
DB and then displays this in different graph formats e.g.
Bar Chart, Pie Chart, Table, ....

At present I allow the DB table and the X and Y Axis Columns to be
selected from combo boxes.  The combo box contents are retrieved
using JSP and stored in the resultant HTML page in JavaScript Arrays.
Thus, a change the table combo populated the X and Y Axis combo's.

When the button to display the chart is clicked a servlet is called.
This servlet then retrieves the X Axis label values and the Y Axis
data values from the DB and graphs it.  The graph is displayed
by the servlet using the ServletOutputStream of the response with
the content type set to "image/gif".  This means that the browser
goes to the next page and then displays the image.

Is there any way that I could have the image being displayed
underneath the combo boxes ?  I would like to avoid using Frames
as they make screens look bad.  If I get the servlet to save the
graph to a file is it possible for me to display that image
(<IMG SRC="myGraph.gif">) underneath the combo's ?

When I am doing this I want the location bar to still have the
location of the .jsp file.  Is there a mechanism to do this ?

I can use the RequestDispatcher as follows:

        HttpSession session = request.getSession(true);
        session.putValue("ir",myGraphingBean);

        response.setContentType("text/html");   // the jsp page generates html

        String path = "/jsp/myGraph.jsp";
        RequestDispatcher rd = context.getRequestDispatcher(path);
        try {
            rd.include(request, response);
        } catch (ServletException se) {
            System.err.println(" -- ServletException -- \n" +
                               "    Reason: " + se.toString());
        } catch (java.io.IOException e) {
            System.err.println(" -- IOException -- \n" +
                               "    Reason: " + e.toString());
        }

but is there anyway to actually do a redirection to the jsp page instead ?

Should I store the current gif in the actual myGraphingBean and display
this in the jsp page ?  Is this possible ?

Thanks for any help,
-John K

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to