Dear friends,
Iam using tif file to show in
jsp page.
when i use jpg file means it is showing correctly. but if i use tif file means nothing is showing.
below is my code:
ServletOutputStream servletOutputStream = response.getOutputStream();
inpfile= "D://test.tif";
try{
response.setContentType("image/tiff");
response.setContentType("image/tif");
response.setContentType("image/jpeg");
response.setHeader("Content-Disposition", "inline; filename=test.tif") ;
FileInputStream fin = new FileInputStream(inpfile);
BufferedInputStream bin = new BufferedInputStream(fin);
BufferedOutputStream bout = new BufferedOutputStream(servletOutputStream);
int ch =0;
while((ch=bin.read())!=-1)
{
bout.write(ch);
}
bin.close();
fin.close();
bout.close();
servletOutputStream.close();
}
catch(Exception e){
e.getMessage();
System.out.println("this is inside catch block:"+e.getMessage() + e.toString());
}