Actually I can do that (make database connection from servlet rendering an
image) but I'd like to avoid that and I'll explain why.
I'm working on one small dashboard. On this dashboard I have one select into
database for retrieving 10-20 rows, each row data is represented by one
gauge widget (Graphics2D image rendered by my servlet). So if I'd like to
show 20 gauge images on one page I can do this by mains:
a) retrieve this one recordset with all 20 records, put this recordset data
into session (I'd like to use request here) and render 20 images using these
data from session
b) I can retrieve once this recordset with 20 records, use ID's from
recordset and forward 20 ID's to my servlet (servlet has to establish 20
additional connections for rendering each image on page resulting in 21
connections in total).
This second approach would work but it doesn't look so good to me. Moreover
when you retrieve data about 20 rows in one pool connection, why not to
exploit it for rendering images instead of retrieving these same data one by
one for each image afterwards? That's why I'd like to put recordset data
into request and send it to jsp page, and page to forward this request
further to servlet rendering images (in <img src=..>) but this request data
is not forwarded!
----- Original Message -----
From: "Larry Meadors" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: 2. srpanj 2007 16:59
Subject: Re: Dynamically rendering image - Servlet/Action
If it's in request scope, I'm assuming it is transient data, so why
not pass the key to the database row to the servlet?
/ImageServlet?rowKey=123
Or if you want to be more clever, even:
/ImageServlet/123
/ImageServlet/123/file.png
I've done that before to deal with stupid browsers that seem to want
to ignore the mime type and insist on fetching a *.do file. Retarded.
anyway, you can read that parameter in your servlet, fetch the data,
and send it back. Easy. :-)
Larry
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]