For images it's quite easy. Use ImageIO to convert the binary data into a BufferedImage, then use ImageIcon and JLabel for displaying it.
For PDF files it's harder, but I believe PDF renderer can help you out.
Sure. You need a separate servlet that will a) set the right content type, b) if possible, set the content size, and c) include only the image / PDF file data and no other data (like leading / trailing whitespace). The latter makes JSP pages not very good for binary data like images or PDF files, as it's really easy to accidentally add leading whitespace. If you decide to use a JSP page, make sure that there are no line breaks whatsoever outside of the JSP tags - not even between directives.
ruba sampath
Greenhorn
Joined: Jun 17, 2011
Posts: 28
posted
0
Thank you very much. Its working now. But how to restrict only upload images and pdf and not other types.
I believe that in HTML5 you can specify file extensions to filter on, but in HTML4 and before you can only refuse to process the files in the form's action page (servlet / JSP / PHP / ...).
subject: View stored blob image in the UI using java