title: displaying Blob (image) in jsp page using struts 2 and hibernate
body: <p>i managed to store an image in my mysql database as Blob. (i am also using hibernate)
  now i am trying to load that image and send it on a jsp page so the user can view the image.</p>
  
  <p>This is my struts 2 action class</p>
  
  <blockquote>
  <pre><code>import java.io.File;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.sql.Blob;
  import org.hibernate.Hibernate;
  
  import domain.post.image.Image;
  
  
  
  public class FileUploadAction {
  
    private File file;
  
    @SuppressWarnings("deprecation")
    public String execute() {
  
        try {
            System.out.println(file.getPath());
            Image image = new Image();
            FileInputStream fi = new FileInputStream(file);
  
            Blob blob = Hibernate.createBlob(fi);
            image.setImage(blob);
            image.save();
  
        } catch (FileNotFoundException e) {
  
            e.printStackTrace();
        } catch (IOException e) {
  
            e.printStackTrace();
        }
        return "success";
    }
  
    public File getFile() {
        return file;
    }
  
    public void setFile(File file) {
        this.file = file;
    }
  </code></pre>
  </blockquote>
  
  <p>and this is my Image class</p>
  
  <blockquote>
  <pre><code>public class Image extends AbsDBObject&lt;Object&gt; {
  
  
    private static final long serialVersionUID = 1L;
    private static Logger logger = Logger.getLogger(Image.class);
    private Blob image;
    private String description;
  
  //Getters and Setters
  
  }
  </code></pre>
  </blockquote>
  
  <p>would you please tell me what should i put in an action class, jsp page and struts.xml in order to showing the stored image?</p>