1 Reply Latest reply on Oct 6, 2012 1:37 PM by cherrera28

    Visual and functional Issues with <rich:fileUpload>

    cherrera28

      Hello community...

       

      Im trying to implement file upload functionality in my application. Im using RichFaces 4.x.

       

      This is the code in my xhtml page:

       

      <?xml version='1.0' encoding='UTF-8' ?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml"

            xmlns:h="http://java.sun.com/jsf/html"

            xmlns:ui="http://java.sun.com/jsf/facelets"

            xmlns:rich="http://richfaces.org/rich"

            xmlns:f="http://java.sun.com/jsf/core"

            xmlns:a4j="http://richfaces.org/a4j">

          <h:head>

              <title><h:outputText value="#{tags['spirit.appname']}"/></title>

              <link href="./styles/styles.css" rel="stylesheet" type="text/css"/>

          </h:head>

          <h:body>

              <ui:composition template="./templates/main.xhtml">

                  <ui:define name="content">

                      <rich:panel styleClass="body">

                          <f:facet name="header"><h:outputText value="#{tags['upload.title']}"/></f:facet>

                          <h:outputText value="#{tags['upload.title']}" styleClass="bodyTitle"/>

                          <p><h:outputText value="#{tags['upload.instructions']}" styleClass="bodyInstructions"/></p>

                          <center>

                              <p>

                                  <h:form>

                                      <h:panelGrid columns="2">

                                          <h:outputText value="#{tags['upload.filename']}" styleClass="formLegends"/>

                                          <h:inputText id="txtFileName" value="#{uploadBean.fileName}" required="true"/>

                                          <h:outputText value="#{tags['upload.filetype']}" styleClass="formLegends"/>

                                          <h:selectOneMenu id="cboTpMaterial" value="#{uploadBean.idTpMaterial}" >

                                              <f:selectItems value="#{uploadBean.listaTpMateriales}" var="tpMaterial"

                                                             itemLabel="#{tpMaterial.nombre}" itemValue="#{tpMaterial.idTpMaterial}"/>

                                          </h:selectOneMenu>

                                          <h:outputText value="#{tags['upload.desc']}" styleClass="formLegends"/>

                                          <h:inputTextarea id="txtDesc" value="#{uploadBean.desc}"/>

                                      </h:panelGrid>

                                      <br/>

                                      <br/>

                                      <h:panelGrid columns="2">

                                          <rich:fileUpload id="txtUpload" fileUploadListener="#{uploadBean.uploadListener}"/>

                                      </h:panelGrid>

                                  </h:form>

                              </p>

                          </center>

                      </rich:panel>

                  </ui:define>

              </ui:composition>

          </h:body>

      </html>

       

      The issues are:

       

      • The component appears without theme or visual aspect in the page (running).
      • The visualization panel are located down in the page respect the upload component (in the showcase appears next rigth to the upload component).
      • With any file i was upload, the visualization panel shows the legend "This XML file does not appear to have any style information associated with it. The document tree is shown below."
      • I need to put a simple (without visualization panel) file upload component without ajax support that upload the file in the submit event with the other fields in the form. I need to disable the visualization functionality but i dont see any tag to disable this feature.

       

      Can you help me to solve this issues.

       

      I really appreciate your help.

       

      Regards.

        • 1. Re: Visual and functional Issues with <rich:fileUpload>
          cherrera28

          Hello community...

           

          Testing the code many times, reviewing the URL in the address bar of any web browsers, im notice that URL never change. This is happening because im implementing implicit navigation. I dont use faces-config declarative navigation or method-based navigation.

           

          After that, i put the complement "?faces-redirect=true" next to the outcome String declarated in "action" property of commandLink tag. This enable the full functionality and visual features of <rich:fileUpload> component.

           

          I hope this will be useful.