struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vijay venkataraman <>
Subject Re: Displaying images from database.
Date Tue, 25 Jul 2006 13:26:44 GMT
Say if all request for images will refer to the same action like, then
So map this to a particular action.
Set the content type and write the image content to the ServletOutputStream
return null for ActionForward.

The snippet below should give you an idea.
Consider if resource.getResource() returns a byte[]  - (Some how you 
should be able to get a byte[] for the image stored in DB.)
If image is of type gif or jpg/jpeg - then you can do something like 
what is shown below.
            String imgType = gif or jpg/jpeg // for understanding.
            String contentType = "image/";
            }else if(imgType.equalsIgnoreCase("jpg")){
            }else {
                contentType = "text/html";
            ServletOutputStream outStream = response.getOutputStream();
            return null;

Vijay Venkataraman wrote:

>Hi All,
>My application saves the images in database as BLOB. I now want to
>display these images stored in my database. How can I do this in struts
>2.0 ?
>Thanks & Regards
>The information contained in this electronic message and any attachments to this message
are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential
or privileged information. If you are not the intended recipient, you should not disseminate,
distribute or copy this e-mail. Please notify the sender immediately and destroy all copies
of this message and any attachments.
>WARNING: Computer viruses can be transmitted via email. The recipient should check this
email and any attachments for the presence of viruses. The company accepts no liability for
any damage caused by any virus transmitted by this email.

This message is for the named person's use only. It may contain 
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mistransmission. 

If you receive this message in error, please immediately delete it and 
all copies of it from your system, destroy any hard copies of it and 
notify the sender. You must not, directly or indirectly, use, disclose, 
distribute, print, or copy any part of this message if you are not the 
intended recipient. 

Lisle Technology Partners Pvt. Ltd. and any of its subsidiaries each 
reserve the right to monitor all e-mail communications through its 

Any views expressed in this message are those of the 
individual sender, except where the message states otherwise and the 
sender is authorized to state them to be the views of any such entity.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message