The moose likes Struts and the fly likes Error in displaying image  using stream Result Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error in displaying image  using stream Result " Watch "Error in displaying image  using stream Result " New topic

Error in displaying image using stream Result

Mumtaz Khan
Ranch Hand

Joined: Feb 21, 2008
Posts: 53
I am developing a web application in struts2 where I need to display image on jsp pages. Many questions have been asked in different forums but I am not be to get solution for my problem.
My application receives images in form of file through mobile application which is being developed in Titanium. I am saving the file as : which saves it as long blob. format of images png.
I am trying to retrieve it in my action class and setting it to inputStream. Here is the code for this: Entry of struts.xml file is : In jsp I am calling the action as:I am able to retrieve the image from database and save in /images under webcontent but not able to display using stream. It says: The image ",......" cannot be displayed because it contains error. I am not getting any exception in log files. In stdout I am getting this: I am not able to understand why image is not being able to displayed? Is it because of length?If so how can I get contentLength for inputStream?
Please help.

Thanks in advance!

SCJP 5.0 -- 97%
I agree. Here's the link: http://aspose.com/file-tools
subject: Error in displaying image using stream Result