Hi,

that sounds good; but how is the action-mapping in the struts-config.xml (I
have no ActionForm)

    <action path="/createImage"
            type="webTemplate.ImageAction">
    </action>

doesn't work

Michael



|--------+----------------------->
|        |          "Craig R.    |
|        |          McClanahan"  |
|        |          <craigmcc@apa|
|        |          che.org>     |
|        |                       |
|        |          13.06.01     |
|        |          20:01        |
|        |          Please       |
|        |          respond to   |
|        |          struts-user  |
|        |                       |
|--------+----------------------->
  >-----------------------------------------------------------------------|
  |                                                                       |
  |       To:     [EMAIL PROTECTED]                          |
  |       cc:     (bcc: Michael Schommer/PDD/DEV/LU/FERNBACH)             |
  |       Subject:     Re: Graphics-Object                                |
  >-----------------------------------------------------------------------|





Content-type: text/plain; charset=iso-8859-1
Content-transfer-encoding: quoted-printable





On Wed, 13 Jun 2001, Michael Schommer wrote:
> Hi,
>
> I want to hang the Graphics-Object for example on the HttpSession and=

read
> it from the JSP by the html:img- or other tag.
> Will it work and how?
>
The fundamental concept is that an Action can, in fact, create the
response itself, if it wants to, and then return null from the
perform() method to indicate to Struts that no forwarding needs to be
done.  Within the action, you would call response.getOutputStream() and=

write the bytes of your image (after doing any necessary conversion and=

setting the correct content type).
In a JSP page that references the dynamically created image, you would =
say
something like:
  <html:img page=3D"/createImage.do"/>
and this will create a hyperlink to the URL that will dynamically creat=
e
the image when the page is displayed.  Like all <img> tags in HTML, the=

image is loaded from a separate request (most browsers will initiate
multiple requests in parallel if you've got multiple images, so be sure=

your session data is thread safe) as the calling page is being displaye=
d.
Alternatively, you might consider creating a separate servlet whose
purpose is to create the dynamic image.  Code very similar to what you'=
d
put in the action would be used to create the image.

> Gru=DF
> Michael
>
Craig McClanahan


=


Reply via email to