After doing some further research, in all likelyhood this can't be
done.

However, a fairly simple work around is to have a JSP with a servlet
as the image source (<img src="/servlet/chartRender>").

The information necessary to dynamically create the image can be
pulled from a session object.

Mike

PS.  JFreeChart seems to be an excellent open source resource for
chart creation:  http://www.jrefinery.com/jfreechart/


--- Mike Duffy <[EMAIL PROTECTED]> wrote:
> The tech tip below shows how to dynamically create an image within
> a
> servlet and send it to the output stream.
>
>
http://developer.java.sun.com/developer/JDCTechTips/2001/tt0821_update.html
>
> In most cases developers want to send both HTML text and images
> when
> dynamically creating a web page.  How can this be done?
>
> "The Servlet specification requires that servlets not call both
> ServletResponse.getOutputStream() and ServletResponse.getWriter().
> "
>
> So, the only way I can think of doing this (images and HTML) is to
> transform the HTML text into a byte array and use the method
> write(byte[] b) from the class OutputStream.
>
> Can anyone think of a more elegant way to do this?
>
> Also, "Because JSP pages already call getWriter(), they must not
> also
> call getOutputStream()."  I think this means that it is impossible
> to
> dynamically create images from a JSP (which was the point of the
> tech
> tip above).
>
> Can anyone think of a way to dynamically generate images within a
> JSP?
>
> Mike
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE Valentine eCards with Yahoo! Greetings!
> http://greetings.yahoo.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to