title: JSF rendered called twice
body: <p>Ok, this little problem is driving me crazy, I got this rendered condition to show an image instead of text in a datatable, I have a method to get the streamed content from a file.</p>
  
  <p>for some reason I don't know, the method is bean called twice, I'm passing a variable imageName to the method that get the streamed content the first time is ok because enters the if, but then the second time variable goes "" and I'm not getting the image. I know this because the second time enter in the else statement and the missing.png image is shown...</p>
  
  <p>I'm using GlassFish 3.1.2 running mojarra 2.1.9 and primefaces 3.5</p>
  
  <p>XHTML:</p>
  
  <pre><code>&lt;p:column headerText="Respuesta"&gt;
                          &lt;p:graphicImage width="200" height="200" value="#{viewFormResponseController.getImageFromPath(viewFormResponse.itemResponse)}" rendered="#{viewFormResponse.itemType == 'FIRMA'}"&gt;&lt;/p:graphicImage&gt;
                          &lt;h:outputText value="#{viewFormResponse.itemResponse}"&gt;&lt;/h:outputText&gt;
                      &lt;/p:column&gt;
  </code></pre>
  
  <p>Bean method</p>
  
  <pre><code>public StreamedContent getImageFromPath(String imageName) throws FileNotFoundException{
      System.out.println("image from path");
      String pathNoImage = "C:\\DataTraceServer\\missing.png";
          if(imageName != null &amp;&amp; viewFormResponses != null &amp;&amp; !imageName.equals("")){
      System.out.println(imageName);
      Device device;
      try {
          device = selectedFormResponse.getDevice();
          String path = "C:\\DataTraceServer\\"+selectedUser.getUsername()+"\\"+device.getImei()+"\\multimediaFile\\"+imageName;
          System.out.println(path);
          String contentType = FacesContext.getCurrentInstance().getExternalContext().getMimeType(path);
          return new DefaultStreamedContent(new FileInputStream(path), contentType);
          } catch (FileNotFoundException ex) {
              System.out.println("exception");
              Logger.getLogger(ViewFormResponseController.class.getName()).log(Level.SEVERE, null, ex);
              String contentType = FacesContext.getCurrentInstance().getExternalContext().getMimeType(pathNoImage);
              return new DefaultStreamedContent(new FileInputStream(pathNoImage), contentType);
          }
          } else {
              System.out.println("else");
              String contentType = FacesContext.getCurrentInstance().getExternalContext().getMimeType(pathNoImage);
              return new DefaultStreamedContent(new FileInputStream(pathNoImage), contentType);
          }
  
      }
  </code></pre>
  
  <p>I've read some similar questions here in Stackoverflow but they aren't clear and they don't look like my problem so please help I've been on this for hours...</p>