struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Brown <aa...@thebrownproject.com>
Subject Re: Return text to jsp, plus image and imageMap from a single Data query?
Date Mon, 05 Sep 2011 12:02:56 GMT
The problem is really an html problem. You cannot embed an image in a web
page, all you can do is embed a url reference to an image. The browser, if
it is a graphical browser and not a text reader, will find that reference
and execute another completely separate request for the image binary. This
is the request that should trigger your binary stream, not the first request
which only gets the base html for the page.

Given this model, it doesn't make much sense to fetch the image from the db
at the same time as the metadata you need to build the textual imagemap
definition. You would either have to just throw away the binary data or else
cache it in expectation of the second request. You've said the caching
system doesn't work for you, so you're better off just fetching the binary
image by itself, in its own dedicated action, when that seecond request
comes in.

- Aaron
 On Sep 5, 2011 6:10 AM, "AndyLaw" <andy.law@roslin.ed.ac.uk> wrote:
>
> On 3 Sep 2011, at 15:07, Dave Newton-6 [via Struts] wrote:
>
>> Okay, so I guess my question is "Why do you want to deliver the result in

>> three separate parts?" Without a clear understanding of what you're
trying
>> to do and why, it's difficult to answer in a helpful way.
>>
>
> The results come back in a single hit which is defined in a JSP page. The
JSP consists of a text table representation of the database results at the
top of the page and a graphical clickable image of those results underneath.
>
> The struts1-based version of the code which I inherited has the action
querying the database, drawing an image to a temporary file, which is then
referenced from within the JSP. One of the problems that they had with the
old version (which is being replaced for a huge number of reasons, not just
this) was the management of "temporary" files broken down frequently
resulting in file system chaos. I would rather avoid writing stuff to file
that can be streamed and forgotten.
>
> I know how to get the stream returned and I can happily generate the image
as a stream and return it. I don't have a clear picture in my head though
about how to generate that image as a stream embedded within a JSP.
>
> My prototype has the jsp reference the graphic-drawing action as the
source of an image. However, if I implement that, I'll need to extract the
data into the action that presents the jsp text and generates the image and
its source reference. I'll also need to extract the data into the action
that generates the referenced image and still find a way to dump back the
html imagemap coordinates and urls to make that image clickable.
>
> I'm clearly suffering a brain-fade here. Is the temporary file route the
way to go or is there something smarter and more "self managing" that I can
do?
>
> Later,
>
> Andy
> --------
> Yada, yada, yada...
>
> The University of Edinburgh is a charitable body, registered in Scotland,
with registration number SC005336
> Disclaimer: This e-mail and any attachments are confidential and intended
solely for the use of the recipient(s) to whom they are addressed. If you
have received it in error, please destroy all copies and inform the sender.
>
>
>
>
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
>
>
> --
> View this message in context:
http://struts.1045723.n5.nabble.com/Return-text-to-jsp-plus-image-and-imageMap-from-a-single-Data-query-tp4762757p4769657.html
> Sent from the Struts - User mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message