uploadFile not work in dialog after redirect

UI Components for JSF
Post Reply
AFC_Primefaces
Posts: 4
Joined: 27 Aug 2015, 16:38

27 Aug 2015, 17:16

Hello!

The uploadFile is working fine in another page with similar code, so i refuse the configuration way.

I select a person to expand his asociated interview in another table, that it will show in another page. To make this, i redirect the page as:

Code: Select all

<p:commandLink id="btnIrNtr" action="path/page.xtml?faces-redirect=true"
               actionListener="#{usuarioBean
                                     .getUsuarioTabla(obj.codPersona, false)}" >
                  <h:graphicImage value="#{msj.imgEntrevista}" 
                                  styleClass="imgCentro"/>
</p:commandLink>
This is the code inside my page:

Code: Select all

 // more code
<p:dialog id="dlgImgNtr" header="#{msj.tImgNtr}" widgetVar="wdgImgNtr"
             closable="false" resizable="false" appendTo="@(body)">
      <h:form id="formImgNtr" enctype="multipart/form-data">
         <p:panel id="panelImgNtr">
            <p:fileUpload mode="simple" value="#{entrevistaBean.auxNtr.archivo}"
                          styleClass="marginTop10" id="fuEditarImgNtr">
               <f:validator validatorId="#{msj.urlValidatorArchivo}"/>
            </p:fileUpload>
            <p:outputLabel id="opObservImg" value="#{msj.fObservacion}" />
            <p:inputTextarea id="ipObservImg" maxlength="500" 
                             value="#{entrevistaBean.auxNtr.observacionesImg}"
                             autoResize="false" styleClass="width100" />

            <h:panelGrid id="btnInfImgNtr" styleClass="marginTop10" columns="2">
               <p:commandButton id="btnImgNtr" value="#{msj.btnGuardar}"
                                process="@this"
                                action="#{entrevistaBean.editarNtr}" 
                                ajax="false" />
               <p:commandButton id="btnImgNtrCerrar" value="#{msj.btnCancelar}"
                          actionListener="#{entrevistaBean.reset('formImgNtr')}"
                                oncomplete="cerrarComponente('wdgImgNtr')"
                                immediate="true" />
            </h:panelGrid>
         </p:panel> 
      </h:form>
   </p:dialog>
If I delete the fileUpload component and the enctype in the form, it works fine.

The actionListener or validator are not fired when commandButton is pushed.

I think that the problem could be located when the pages reload and how it make the upload file, because it´s the only difference that i found.

Any idea will be wellcome!
Primefaces 5.0
Hibernate 4.2.7
SpringFramework 4.0.1

AFC_Primefaces
Posts: 4
Joined: 27 Aug 2015, 16:38

29 Aug 2015, 13:07

Hello Friends!

I find my error. Finally it was a wrong configuration.

In web xml we must set where we are going to use the upload file. In my case it will be:

Code: Select all

<filter-mapping>
      <filter-name>Primefaces FileUpload Filter</filter-name>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>/usuario/*</url-pattern>
      <url-pattern>/tratamiento/*</url-pattern>
   </filter-mapping>
Primefaces 5.0
Hibernate 4.2.7
SpringFramework 4.0.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 62 guests