Don't use ServletOutputStream within Struts2. Use a StreamResult instead:
http://struts.apache.org/2.0.11/docs/stream-result.html
In the example provided in the above link, inputName references a
property in your action that's an InputStream you need to create from
your data.
InputStream getInputStream();
If you search, you'll find plenty of examples using StreamResult.
regards,
Jeromy Evans
Johnson nickel wrote:
Hi Evans,
I want to display the images in browser from the database.
I have added my code.It throws null pointer Exception.
In my action, i have implements
ServletRequestAware,ServletResponseAware interface. I want to
know if ServletOutputStream is working in Struts 2.0.6 action class.
Can u give a solution for this.
InputStream in = rs.getBinaryStream("filedata");
response.setContentType("image/jpeg");
response.addHeader("Content-Disposition","inline;filename=" filename);
ServletOutputStream out = response.getOutputStream();
out.flush();
int c;
while ((c = in.read()) != -1)
{
out.write(c);
}
in.close();
out.close();
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.15/1174 - Release Date: 6/12/2007 10:11 AM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]