-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Is it good practice to store images in a database for webapplications? I
allways thougth space is better.

Thanks for your answer and the link

Martin Gainty wrote:
> 2 possibly ways
> <img src with an embedded <bean:write
> 
> OR 
> 
> <jsp:useBean with embedded <html:image
> 
> take a look at
> http://www.velocityreviews.com/forums/t135655-help-sessions-images-amp-beans-no-cookies-please.html
> 
> Anyone else?
> M-
> *********************************************************************
> This email message and any files transmitted with it contain confidential
> information intended only for the person(s) to whom this email message is
> addressed.  If you have received this email message in error, please notify
> the sender immediately by telephone or email and destroy the original
> message without making a copy.  Thank you.
> 
> 
> 
> ----- Original Message ----- 
> From: "C. Grobmeier" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <user@struts.apache.org>
> Sent: Tuesday, July 25, 2006 9:55 AM
> Subject: Re: Displaying images from database.
> 
> 
> Then how can one have an Java-Object, let's say Person.java. Person has
> a property called 'avatare' which can be get with "File getAvatar()".
> Can i do something like <bean:write name="avatar"> or so?
> 
> Btw- this isn't really good practice, is it? The example below seems
> good for an Ajax request but i am not sure if i should store my images
> as a blob.
> 
> chris
> 
> Thomas Joseph wrote:
>>>> Hi Prerna,
>>>>
>>>> Use the Action Class for the image display solely for image display. When 
>>>> the browser executes the  <img src="GetImage.do?param1=blah&param2=xyz"> 
>>>> tag, it is basically giving a saparate request to your action class that 
>>>> generates the image.  Notice that the action class returns null, which 
>>>> means that the action class will render the response itself and will not 
>>>> forward to any JSP page.  The remaining protions of your JSP will be 
>>>> generated by other Action Class forwards as usual.
>>>>
>>>> Hope this helps to understand better.
>>>>
>>>> Thanks and Regards,
>>>> Thomas Joseph 
>>>>
>>>> Kott Software Pvt. Ltd. | Vallamattom Estate | M.G.Road | Cochin-682015 | 
>>>> India 
>>>> www.kottsoftware.com 
>>>> --------------------------------------------------------------------------------
>>>> This email (including any attachments) is subject to copyright, the 
>>>> information in it is confidential, and it is legally privileged. Use of 
>>>> this email or of any information in it other than by the addressee is 
>>>> unauthorized and unlawful. If you are not the intended recipient of the 
>>>> mail, kindly intimate the author of the mail and delete the same. 
>>>> --------------------------------------------------------------------------------
>>>>
>>>>   ----- Original Message ----- 
>>>>   From: [EMAIL PROTECTED] 
>>>>   To: user@struts.apache.org 
>>>>   Sent: Tuesday, July 25, 2006 6:37 PM
>>>>   Subject: RE: Displaying images from database.
>>>>
>>>>
>>>>
>>>>   Hi David
>>>>
>>>>   Thanks for a prompt response.
>>>>
>>>>   But I also want to display other things on the jsp page besides the
>>>>   image.
>>>>   For e.g.
>>>>
>>>>   My jsp page would have
>>>>
>>>>   Company name, Address, Business Area and its logo with an EDIT button
>>>>   and when the user clicks on the EDIT button he can update Address
>>>>   information and save the changes made
>>>>
>>>>   How can I achieve this?
>>>>
>>>>   Thanks & Regards
>>>>   Prerna
>>>>
>>>>   -----Original Message-----
>>>>   From: David Soler [mailto:[EMAIL PROTECTED]
>>>>   Sent: Tuesday, July 25, 2006 6:43 PM
>>>>   To: Struts Users Mailing List
>>>>   Subject: RE: Displaying images from database.
>>>>
>>>>   Try the following:
>>>>
>>>>   /******* JSP file ************/
>>>>
>>>>   <%@ taglib uri="/tags/struts-html" prefix="html" %>
>>>>   <html:html locale="true">
>>>>   <head>
>>>>   <html:base/>
>>>>   </head>
>>>>   <body>
>>>>   <%
>>>>   HashMap params = new HashMap();
>>>>   params.put("ID", request.getParameter("ID"));
>>>>   pageContext.setAttribute("params", params);
>>>>   %>
>>>>   <html:img page="/GetImage.do" name="params"/>
>>>>   </body>
>>>>   </html:html>
>>>>
>>>>
>>>>   /******* Action class *************/
>>>>
>>>>   import javax.servlet.http.HttpServletRequest;
>>>>   import javax.servlet.http.HttpServletResponse;
>>>>   import javax.servlet.http.HttpSession;
>>>>   import javax.servlet.*;
>>>>   import org.apache.struts.action.Action;
>>>>   import org.apache.struts.action.ActionForm;
>>>>   import org.apache.struts.action.ActionForward;
>>>>   import org.apache.struts.action.ActionMapping;
>>>>
>>>>   public class GetImageAction extends Action {
>>>>   public ActionForward execute(
>>>>   ActionMapping mapping,
>>>>   ActionForm form,
>>>>   HttpServletRequest request,
>>>>   HttpServletResponse response) throws Exception{
>>>>
>>>>   byte[] b;
>>>>
>>>>   //Here the code to take the image from the database (you
>>>>   need the parameter ID).
>>>>   //Put the bytes into array b[]
>>>>
>>>>   //response.setContentType("image/gif"); //it's not
>>>>   necessary
>>>>   ServletOutputStream sout = response.getOutputStream();
>>>>
>>>>   sout.write(b);
>>>>   sout.flush(); 
>>>>   sout.close();
>>>>
>>>>   return null;
>>>>   }
>>>>   }
>>>>
>>>>   David
>>>>
>>>>
>>>>
>>>>   -----Mensaje original-----
>>>>   De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>>>>   Enviado el: martes, 25 de julio de 2006 14:34
>>>>   Para: user@struts.apache.org
>>>>   Asunto: Displaying images from database.
>>>>
>>>>
>>>>   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
>>>>
>>>>   Prerna
>>>>
>>>>
>>>>
>>>>
>>>>   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.
>>>>
>>>>
>>>>   www.wipro.com
>>>>
>>>>   ---------------------------------------------------------------------
>>>>   To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>   For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>>   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.
>>>>
>>>>   www.wipro.com
>>>>
>>>>   ---------------------------------------------------------------------
>>>>   To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>>   For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFExi/ekv8rKBUE/T4RAogqAJ4qqvCHtv2wL5a8cDLTmBSw+SPMHACfecrJ
jMAAvAXgTl5b1ol/3ck79+4=
=4jfl
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to