Hi,
Pls help me out on showing an image stored as blob data type in the db and i am retriving it and keeping it as inputstream,writing it to outpout stream but cann't display the output stream object in the jsf.
Below is the code that i have written. Advise me if anything wrong with code.
//method name in the bean
public void showImageFrmLocal()
InputStream fileInputStream = null;
//here it get the image from db as fileInputStream
fileInputStream = files.get(i).getFilesInputStream();
fileInputStream = new BufferedInputStream(files.get(i).getFilesInputStre am());
for (int length = 0; (length = fileInputStream.read(byteArray)) > 0 {
//output.write(byteArray, 0, length);
response.getOutputStream().write(byteArray, 0, length);
}
fileInputStream.close();
}
response.getOutputStream().close();
FacesContext.getCurrentInstance().responseComplete ();
FacesContext.getCurrentInstance().renderResponse() ;
And the jsf is
<h:commandLink id="imagId1" value="View Image" style="position: relative;"
actionListener="#{Bean.showImageFrmLocal}">
</h:commandLink>