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 belows show 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, send email to [EMAIL PROTECTED] and include in
> the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives:
> http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>


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

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to