title: Can't display blob image in jsp in Spring MVC app
body: <p>I save and load image to <code>MySQL 5.5</code> database via <code>Hibernate</code> as <code>byte[]</code> in java and <code>blob</code> in database. Nevertheless when I can't display it in <code>jsp</code>.</p>
  
  <p>My controller:</p>
  
  <pre><code>@RequestMapping(value = "/productPicture/{productPictureId}/edit", method = RequestMethod.GET)
  public String productPictureEditGET(@PathVariable("productPictureId") int productPictureId, HttpServletRequest request, Model model) {
  
      ProductPictureFormBO productPicture = productPictureService.getById(productPictureId, ProductPictureFormBO.class, ProductPictureEntity.class);
  
      byte[] encoded=org.apache.commons.codec.binary.Base64
              .encodeBase64(productPicture.getPicture());
      String encodedString = new String(encoded);
  
      model.addAttribute("image",encodedString);
      model.addAttribute("productPicture", productPicture);
  
      return "productPicture/editView";
  }
  </code></pre>
  
  <p>and then in jsp both elements don't display anything...:</p>
  
  <pre><code>  &lt;img src="data:image/jpeg;base64,${image}" alt="..." width="200" height="200"&gt;`
    &lt;img src="data:image/jpeg;base64,${productPicture.picture}" width="200" height="200"&gt;`
  </code></pre>
  
  <p>Result in jsp:</p>
  
  <pre><code>&lt;img src="data:image/jpeg;base64,MTA4ODg4MTdfMTAyMDM1NjkyNTEzMzQ1MThfNzg0MzE4ODI3Mjc5Mjk0NTQ3MF9uLmpwZw=="  width="200" height="200"&gt;
  &lt;img src="data:image/jpeg;base64,[B@1666a2e3" width="200" height="200"&gt;
  </code></pre>
  
  <p>Any idea what I'm missing and how to fix it?</p>