struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jin Bal" <jin...@hotmail.com>
Subject Re: Image rendering components
Date Thu, 10 Oct 2002 12:36:57 GMT
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" <MohanR@hclcomnet.co.in>
To: "'Struts Users Mailing List'" <struts-user@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:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message