jsf - Is it possible to disable f:event type=“preRenderView” listener on fileupload primefaces -


i have fileuploader disappears after partial site refresh

here xhtml file

<?xml version='1.0' encoding='utf-8' ?> <!doctype composition public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"     template="/web-inf/templates/traleerdf-template.xhtml"     xmlns:h="http://xmlns.jcp.org/jsf/html"     xmlns:p="http://primefaces.org/ui"     xmlns:f="http://xmlns.jcp.org/jsf/core"     xmlns="http://www.w3.org/1999/xhtml">  <ui:define name="content">     <f:metadata>         <f:event type="prerenderview"                  listener="#{registration.loadregistrationdetails()}" ></f:event>     </f:metadata>     <p:ajaxstatus onstart="pf('statusdialog').show();" onsuccess="pf('statusdialog').hide();"/>     <p:dialog modal="true" widgetvar="statusdialog" header="saving"               draggable="false" closable="false">     <p:graphicimage value="/images/ajax-loader.gif"/>     </p:dialog>      <h:form id="form" enctype="multipart/form-data">        <p:panelgrid  id="detail" columns="1" >           <p:datatable var="reg" id="datatable" value="#{registration.registrationdtos}" rows="12">              <p:column headertext="name" style="width:5%">                 <p:outputlabel value="#{reg.sourcename}"/>              </p:column>              <p:column headertext="path prefix" style="width:5%">                  <p:outputlabel value="#{reg.pathprefix}"/>               </p:column>               <p:column headertext="template file" style="width:30%">                   <p:commandbutton id="templatebutton" value="get template" oncomplete="tempdlg.show();" process="@this" title="template file"                     update=":topform:form:growl :topform:form:tempid">                     <f:setpropertyactionlistener value="#{reg}" target="#{registration.registrationdto}" />                   </p:commandbutton>                </p:column>                <p:column style="width:2%" headertext="update">                    <p:commandbutton id="selectbutton" update=":topform:form:growl :topform:form:display"  process="@this" oncomplete="regdialog.show()" icon="ui-icon-search" title="edit">                    <f:setpropertyactionlistener value="#{reg}" target="#{registration.registrationdto}" />                    </p:commandbutton>                 </p:column>            </p:datatable>            <p:dialog header="registration detail" widgetvar="regdialog" resizable="false" id="regdlg" showeffect="fade" hideeffect="explode" modal="true">                <p:panelgrid id="display" columns="2" style="margin:0 auto;" >                   <p:outputlabel id="lblendpoint" for="txtendpoint" value="#{msg['registration.endpoint']}"/>                   <h:outputtext id="txtendpoint" value="#{registration.registrationdto.endpoint}"/>                    <p:outputlabel id="lblsourcename" for="txtsourcename" value="#{msg['registration.sourcename']}"/>                     <p:inputtext  required="true"  id="txtsourcename" value="#{registration.registrationdto.sourcename}" requiredmessage="source name not entered"/>                      <p:outputlabel  id="lblpathprefix" for="txtpathprefix" value="#{msg['registration.pathprefix']}"/>                      <p:inputtext  disabled="true" required="true" id="txtpathprefix" size="20" value="#{registration.registrationdto.pathprefix}" requiredmessage="path prefix required"/>                      <p:outputlabel id="lbltemplatefile" for="txttemplatefile" value="#{msg['registration.templatefile']}"/>                     <p:fileupload required="true" id="txttemplatefile" fileuploadlistener="#{registration.uploadtemplatefile}"  requiredmessage="template file required"                     mode="advanced" widgetvar="txttemplatefile" value="#{registration.registrationdto.templatefile}" update=":topform:form:growl">                                                                       </p:fileupload>                     <h:panelgroup>                       <p:commandbutton icon="ui-icon-disk" id="btnupdte" update=":topform:form:growl :topform:form:panel" ajax="true" action="#{registration.updateregistration()}" style="margin-right:20px;"                                              value="update" >                       </p:commandbutton>                     </h:panelgroup>                 </p:panelgrid>             </p:dialog>              <p:dialog header="template dialog" widgetvar="tempdlg" modal="true" height="100" showeffect="fade" hideeffect="explode">                 <p:panelgrid id="tempid" style="margin:0 auto;" columns="2">                    <p:outputlabel id="templatefilelbl" for="templatefile" value="#{msg['registration.templatefile']}"/>                      <h:outputtext value="#{registration.registrationdto.templatefile}" id="templatefile"/>                 </p:panelgrid>               </p:dialog>           </p:panelgrid>        </p:panel>     </h:form>    </ui:define>  </ui:composition> 

the upload button open new dialog allows user edit fields , can upload new template file.

my problem every time upload button in dialog clicked, f:event method method invoked expected of type prerender there anyway avoid event call fileupload because overwriting template file name uploaded. (prerender method making call db list of details in case overriding template file.)

from namespaces you're using, presume you're using jsf 2.2. in version, can have

<f:viewaction action="#{registration.loadregistrationdetails()}"/> 

the viewaction tag not executed on postback default.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -