小编Kel*_*tor的帖子

如何在上传primefaces后重新加载jsf页面?

在primefaces上传后,重新加载jsf页面有什么用?

我尝试使用javascript oncomplete="javascript:window.location.reload()",但它不起作用:

XHTML:

<h:form>
    <p:messages showDetail="true"/>  
    <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)$/" />
</h:form>
Run Code Online (Sandbox Code Playgroud)

豆:

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, …
Run Code Online (Sandbox Code Playgroud)

javascript jsf file-upload primefaces jsf-2

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

file-upload ×1

javascript ×1

jsf ×1

jsf-2 ×1

primefaces ×1