primefaces - Haw can I do for making button show me fileupload -


haw can diplay fileupload when press commande button.

<p:commandbutton icon="ui-icon-refresh" onclick="data.show()"></p:commandbutton>   

this fileupload

<h:form enctype="multipart/form-data" id="t" >                    <p:fileupload  auto="true" disabled="true" id="data"                    fileuploadlistener="#{composantbean.handlefileupload}"                    sizelimit="2097152"                    label="choose"                    allowtypes="/(\.|\/)(pdf)$/"                    description="images"/>                   </h:form> 

on solution file uplad displayed ..haw can

i don't quite understand need. want display p:fileupload after click p:commandbutton?

if so, need create boolean variable in bean(controller) , when clicking on button, set true. this:

.xhtml

<p:commandbutton icon="ui-icon-refresh" action="#{testcontroller.renderfileupload()}" update="@this"/>    <p:fileupload auto="true" id="data" rendered="#{testcontroller.isrenderfu()}"                fileuploadlistener="#{composantbean.handlefileupload}"                sizelimit="2097152"                label="choose"                allowtypes="/(\.|\/)(pdf)$/"                description="images"/>  

testcontroller

... private boolean renderfu = false;  public void renderfileupload(){     renderfu = true; }  public boolean isrenderfu() {     return renderfu; }  public void setrenderfu(boolean renderfu) {     this.renderfu = renderfu; 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -