My Image is not showing in my JSP. It shows as a broken image and the html returns a error 500
This is the code for my JSP
<td style="padding: 25px;">
<a href="CompositeDetails?caseNo=${photo.caseNo}"> <img src="imageDisplay?caseNo=${photo.caseNo}" width="120"/></a>
</td>
here is my controller for imageDisplay
@RequestMapping(value = "/imageDisplay", method = RequestMethod.GET)
public void showImage(@RequestParam("caseNo") String caseNo, HttpServletResponse response, HttpServletRequest request) throws IOException {
GalleryResults gr = galleryService.getCompositeSketch(caseNo);
FileInputStream fileInputStream = new FileInputStream(gr.getPhotoLocation());
byte[] bytes = IOUtils.toByteArray(fileInputStream);
response.setContentType("image/jpeg, image/jpg, image/png, image/gif");
response.getOutputStream().write(bytes);
response.getOutputStream().close();
}
my query there returns the location as: C:\Files\*.png
Yes, the picture is in my drive.
Aucun commentaire:
Enregistrer un commentaire