Jsf 在ADF中提交带有文件的表单后,如何在表单中重置inputfile

Jsf 在ADF中提交带有文件的表单后,如何在表单中重置inputfile,jsf,oracle-adf,Jsf,Oracle Adf,我有一个表单,其中有3个输入字段和一个af:inputFile,我需要上传文件并最终保存。 我无法将valueChangeEvent用于inputFile,因为如果我使用用户ResetUtils,则无法获取表单输入值。 保存时一切正常,但当我再次添加记录时,最后更新的文件仍显示在inputFile中(未重置)。 保存后,如果我将输入文件绑定设置为null,则使用绑定对组件执行部分触发加载页面需要花费大量时间来保存,因此我无法使用它 这是我的密码 <af:panelFormLayout id

我有一个表单,其中有3个输入字段和一个af:inputFile,我需要上传文件并最终保存。 我无法将valueChangeEvent用于inputFile,因为如果我使用用户ResetUtils,则无法获取表单输入值。 保存时一切正常,但当我再次添加记录时,最后更新的文件仍显示在inputFile中(未重置)。 保存后,如果我将输入文件绑定设置为null,则使用绑定对组件执行部分触发加载页面需要花费大量时间来保存,因此我无法使用它

这是我的密码

<af:panelFormLayout id="pfl1" rows="3">
<af:inputText value="#{bindings.Title.inputValue}" label="#{bindings.Title.hints.label}"
                                required="#{bindings.Title.hints.mandatory}"
                                columns="#{bindings.Title.hints.displayWidth}"
                                maximumLength="#{bindings.Title.hints.precision}"
                                shortDesc="#{bindings.Title.hints.tooltip}" id="it1" contentStyle="width:150px">
                    <f:validator binding="#{bindings.Title.validator}"/>
                  </af:inputText>
  <af:panelGroupLayout id="pgl350" layout="horizontal">
<af:inputFile label="Select" id="if51" value="#{ContractDocumentUploadDwn.file}"
showRequired="true" binding="#{ContractDocumentUploadDwn.inputFileBinding}"/>
<af:button text="Upload" id="b353" action="#{ContractDocumentUploadDwn.uploadPortfolioDoc}"/>
 </af:panelGroupLayout>
</af:panelFormLayout>

这不是你在会议上问的同一个问题吗

你试过那里给出的解决方案了吗

public void savePortfolioDoc(ActionEvent actionEvent) {
    // Add event code here...

    DCIteratorBinding iter = getDCIteratorBinding("portfolioDocument1Iterator");
    UploadedFile myfile = (UploadedFile) this.getInputFileBinding().getValue();
    String binding = "Commit1";
    String popUpId = "p2";
    genericSaveDocuments(actionEvent, iter, myfile, binding, popUpId, "Portfolio");//Saves the document
    this.getInputFileBinding().resetValue();
    this.setFile(null);
    // Reset inputFile component after upload
    ResetUtils.reset(this.getInputFileBinding());
    //iter.executeQuery();
    //iter.refresh(1);
}
只需转到上传按钮所在的弹出窗口。 然后在properties“Content Delivery”中设置为lazyUncache 将“ChildChildren”设置为立即 “自动取消”设置为禁用 最后 取消时,“可重置值”设置为 它会正常工作的
快乐编码:)

不知道这是否是您问题的解决方案,但是。。。在
查看JSP的第一行,我已经编辑了我的问题,请检查。没有语法错误。在错误地复制和粘贴代码时,输入了该字符。这一切看起来都很混乱,您的描述和代码不匹配。看起来你有单独的按钮来上传文件,为什么?如果您提交表单,可以使用“仅提交”按钮。一般来说,您不需要为表单执行或刷新。但是,您确实需要调用PPR操作来形成包装器,如
panelFormLayout
,以使bean中的更改可见。好的,您使用inputFile中的value属性。你也必须重新设置这个。我更改了上面的代码。
public void savePortfolioDoc(ActionEvent actionEvent) {
    // Add event code here...

    DCIteratorBinding iter = getDCIteratorBinding("portfolioDocument1Iterator");
    UploadedFile myfile = (UploadedFile) this.getInputFileBinding().getValue();
    String binding = "Commit1";
    String popUpId = "p2";
    genericSaveDocuments(actionEvent, iter, myfile, binding, popUpId, "Portfolio");//Saves the document
    this.getInputFileBinding().resetValue();
    this.setFile(null);
    // Reset inputFile component after upload
    ResetUtils.reset(this.getInputFileBinding());
    //iter.executeQuery();
    //iter.refresh(1);
}