Primefaces 正在删除上载的文件

Primefaces 正在删除上载的文件,primefaces,Primefaces,我使用以下代码删除使用primefaces上传的文件 <p:column width="35" headerText="Delete" style="text-align:center"> <h:commandLink ajax="true" update="@form" title="Delete Document" process="@form" action="#{learningGuaranteeBean.deleteDocument()}"

我使用以下代码删除使用primefaces上传的文件

<p:column width="35" headerText="Delete" style="text-align:center">
    <h:commandLink ajax="true" update="@form" title="Delete Document"
        process="@form" action="#{learningGuaranteeBean.deleteDocument()}"
        disabled="#{(learningGuaranteeBean.activeEntry.statusCode ne 3) and (learningGuaranteeBean.activeEntry.statusCode ne null)}">
        <f:setPropertyActionListener
            target="#{learningGuaranteeBean.selectedDocument}"
            value="#{doc}"></f:setPropertyActionListener>
        <h:graphicImage value="../images/icons/delete.gif"></h:graphicImage>
    </h:commandLink>
</p:column>


但是,当我删除一个附加文件时,整个jsf页面都会重新加载,因此当我删除附加文件时,输入字段中输入的数据就会消失。有谁能帮我防止这种情况发生吗?

您似乎错误地使用了
h:commandLink
而不是
p:commandLink
。由于
h:commandLink
甚至没有
进程
更新
ajax
属性,因此会导致非ajax提交,因此会重新加载页面

使用
p:commandLink


如果出于某种原因需要
h:commandLink
,则用错误的属性替换适当的
f:ajax
标记。

这与问题无关,但对于现代EL版本,您不需要
f:setPropertyActionListener
。您只需将一个参数传递给操作方法:
action=“#{learningguarantebean.deleteDocument(doc)}”