完成上传文件,然后执行按钮的jsf:action [英] Finish uploading files and then execute the jsf:action of the button
本文介绍了完成上传文件,然后执行按钮的jsf:action的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如代码中所示,fileupload调用一个方法,该方法将文件保存在列表中<>.从按钮上传带有规则PF("fileupload")的上传文件(). 我需要的是,当您上传预加载的"n"时,最近在上传结束时,请执行按钮的操作方法.
The fileupload, as seen in the code, call a method, which saves files in a List <>. The upload files from the button with the ruling PF ('fileupload') upload ().; What I need here is that when you upload the "n" preloaded, recently at the end of the upload, execute the action method of the button.
<p:fileUpload id="fileupload"
widgetVar="fileupload"
fileUploadListener="#{incidentBean.handleAttachment}"
mode="advanced"
label="Adjuntar (máx. 800kb)"
invalidFileMessage="Archivo inválido"
update="form-attachments"
allowTypes="/(\.|\/)(jpg|jpeg|gif|png)$/"
multiple="true"
sizeLimit="820000"
invalidSizeMessage="Archivo pesado" />
<button class="btn btn-info"
type="submit"
jsf:id="cmd"
jsf:action="#{incidentBean.save()}"
jsf:onclick="PF('fileupload').fileupload();">
感谢您的帮助.
推荐答案
您可以将fileupload的oncomplete
属性简单地连接到<p:remoteCommand/>
,这样您就可以:
You could simply connect the oncomplete
attribute of the fileupload to a <p:remoteCommand/>
, such that you'll have:
<p:remoteCommand name="save" actionListener="#{incidentBean.save}"/>
和
<p:fileUpload id="fileupload" oncomplete="save();" widgetVar="fileupload"/>
这篇关于完成上传文件,然后执行按钮的jsf:action的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文