You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mohan Radhakrishnan <Mo...@hclcomnet.co.in> on 2002/10/10 13:45:00 UTC

Image rendering components

Hi,
        I have a StringBuffer of HTML that includes a generated image. My
DTO carries it to the presentation tier. How is usually included in the JSP
stream ? Tags ?
bye,
Mohan


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Image rendering components

Posted by Jin Bal <ji...@hotmail.com>.
Your action could write the html from your DTO directly to the response,
without the need to forward to a JSP.

this would go along the lines of:
<snip>
  inStream = docLib.getDataStream();
  ByteArrayOutputStream out =new ByteArrayOutputStream();
        byte[] buf = new byte[4096];
  int i = -1;
  while ((i = inStream.read(buf))!=-1){
   out.write(buf,0,i);
  }
  response.setContentType(docLib.getContentType());
        response.setIntHeader("Content-length",docLib.getSize().intValue());

response.setHeader("Content-disposition","attachment;filename="+docLib.getFi
lename());
     ServletOutputStream sout = response.getOutputStream();
  out.writeTo(sout);
  out.flush();
        out.close();
        return null;
</snip>

or something similar where you'd be writing the bytes of html string out.

HTH

Jin

----- Original Message -----
From: "Mohan Radhakrishnan" <Mo...@hclcomnet.co.in>
To: "'Struts Users Mailing List'" <st...@jakarta.apache.org>
Sent: Thursday, October 10, 2002 12:45 PM
Subject: Image rendering components


> Hi,
>         I have a StringBuffer of HTML that includes a generated image. My
> DTO carries it to the presentation tier. How is usually included in the
JSP
> stream ? Tags ?
> bye,
> Mohan
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>