title: How reload jsf page after primefaces upload?
body: <p>What a may to reload a jsf page after primefaces upload?</p>
  
  <p>I try with javascript <code>oncomplete="javascript:window.location.reload()"</code>, but it's doesn't work:</p>
  
  <p><strong>xhtml:</strong></p>
  
  <pre><code>&lt;h:form&gt;
      &lt;p:messages showDetail="true"/&gt;  
      &lt;p:fileUpload fileUploadListener="#{revistauploadBean.upload}"
                    mode="advanced" dragDropSupport="false" merge="true"  
                    uploadLabel="Enviar" cancelLabel="Cancelar"
                    oncomplete="javascript:window.location.reload()"
                    label="Procurar PDF" sizeLimit="1000000000" fileLimit="3"
                    allowTypes="/(\.|\/)(pdf)$/" /&gt;
  &lt;/h:form&gt;
  </code></pre>
  
  <p><strong>Bean:</strong></p>
  
  <pre><code>public void upload(FileUploadEvent event) throws SQLException {  
      LoginAuthentication user = new LoginAuthentication();
      FacesMessage msg = new FacesMessage("Success! ", event.getFile().getFileName() 
          + " is uploaded.");  
      FacesContext.getCurrentInstance().addMessage(null, msg);
      // Do what you want with the file        
      try {
          copyFile(event.getFile().getFileName(), event.getFile().getInputstream());
          ConectaBanco mysql = new ConectaBanco();
          mysql.insere("INSERT INTO edicoes VALUES (NULL, '" 
              + mysql.pegaIDrev(user.getNome()) 
              + "', NULL, NULL, NULL, NULL, '" 
              + event.getFile().getFileName()
              + "' );");
          File pasta = new File(caminhoPastaPDF 
              + "/convertidos/" 
              + event.getFile().getFileName());
          pasta.mkdir();
          convertePdf(event.getFile().getFileName());
          FacesMessage msg1 = new FacesMessage("Succesful", event.getFile().getFileName() 
              + " is uploaded.");  
          FacesContext.getCurrentInstance().addMessage(null, msg1); 
      } catch (IOException e) {
          e.printStackTrace();
      }
  
  }  
  
  public void copyFile(String fileName, InputStream in) {
      try {
          // write the inputStream to a FileOutputStream
          OutputStream out = new FileOutputStream(new File(destination + fileName));
          int read = 0;
          byte[] bytes = new byte[1024];
          while ((read = in.read(bytes)) != -1) {
              out.write(bytes, 0, read);
          }
          in.close();
          out.flush();
          out.close();
          ////System.out.println("New file created!");
      } 
  }
  </code></pre>
  
  <p>There are another ways to do that?
  I want to refresh a <code>&lt;a4j:repeat&gt;</code></p>