5 Replies Latest reply on Jun 3, 2008 5:26 AM by psw

    Problem with t:inputFileUpload in one page with t:dataScroll

      Hi all! Need help with a simple form, which has one dataTable with scroller and uses csv file as an input.

      FileUpload is from Tomahawk, and no AJAX is used for it.
      The exception occurs on submit when the file is uploaded.
      "
      Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /secure/IpResolver.jsp][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id_jsp_1520923443_12]}

      Caused by:
      java.lang.IllegalArgumentException - could not find UIData referenced by attribute dataScroller@for = 'resolveDataTable'
      "

      Seems like the problem is with searching a dataTable component by Id.

      I tried to use two forms: the first with "multipart/form-data" encoding type - for the uploading, and the other with "application/x-www-form-urlencoded" for the rest, or just one form - and the result was the same. Exception on RenderResponse.

      Did anyone have such problems? What am I doing wrong?

      Here is some code:


       <t:inputFileUpload id="fileUploaderInput"
       accept="application/csv"
       value="#{uploadedFile.upFile}"
       storage="file"
       styleClass="fileUploadInput"
       required="true"
       maxlength="200000"
       title="#{strings['forms.file_upload_title']}"
       size="30" >
       </t:inputFileUpload>
      
       <h:commandButton type="submit"
       value="#{strings['forms.button.file_upload']}"
       actionListener="#{uploadedFile.upload}" />
      


      <h:panelGroup>
       <t:dataTable id="resolveDataTable"
       styleClass="scrollerTable"
       headerClass="standardTable_Header"
       footerClass="standardTable_Header"
       rowClasses="standardTable_Row1,standardTable_Row2"
       columnClasses="standardTable_Column"
       var="resolving"
       value="#{uploadedFile.resolvings}"
       first="#{uploadedFile.first}"
       preserveDataModel="true"
       rows="#{uploadedFile.rows}"
       rowId="#{resolving.key}"
       rowOnMouseOver="this.className='standardTable_Row_MouseOver'"
       rowOnMouseOut="this.className='standardTable_Row_MouseOut'"
       rowOnClick="this.className='standardTable_Row_MouseClick'"
       rowOnDblClick="this.className='standardTable_Row_MouseDoubleClick'" >
      
       <h:column>
       <f:facet name="header">
       <h:outputText value="#{strings['forms.ip_resolver.key']}" />
       </f:facet>
       <h:outputText value="#{resolving.key}" />
       </h:column>
       <h:column>
       <f:facet name="header">
       <h:panelGrid width="420">
       <h:outputText value="#{strings['forms.ip_resolver.value']}" />
       </h:panelGrid>
       </f:facet>
       <h:outputText value="#{resolving.value}" />
       </h:column>
       </t:dataTable>
      
       <t:dataScroller id="resolveScroller"
       for="resolveDataTable"
       fastStep="10"
       rowsCountVar="rowsCount"
       displayedRowsCountVar="displayedRowsCountVar"
       firstRowIndexVar="firstRowIndex"
       lastRowIndexVar="lastRowIndex"
       pageCountVar="pageCount"
       pageIndexVar="pageIndex"
       renderFacetsIfSinglePage="false"
       styleClass="scroller"
       paginator="true"
       paginatorMaxPages="9"
       paginatorTableClass="paginator"
       paginatorActiveColumnStyle="font-weight:bold;"
       immediate="true">
       <f:facet name="first" >
       <t:graphicImage url="images/tables/arrow-first.gif" border="1" />
       </f:facet>
       <f:facet name="last">
       <t:graphicImage url="images/tables/arrow-last.gif" border="1" />
       </f:facet>
       <f:facet name="previous">
       <t:graphicImage url="images/tables/arrow-previous.gif" border="1" />
       </f:facet>
       <f:facet name="next">
       <t:graphicImage url="images/tables/arrow-next.gif" border="1" />
       </f:facet>
       <f:facet name="fastforward">
       <t:graphicImage url="images/tables/arrow-ff.gif" border="1" />
       </f:facet>
       <f:facet name="fastrewind">
       <t:graphicImage url="images/tables/arrow-fr.gif" border="1" />
       </f:facet>
       </t:dataScroller>
       </h:panelGroup>
      


        • 1. Re: Problem with t:inputFileUpload in one page with t:dataSc
          ilya_shaikovsky

          why do you think this caused by richfaces? I can't see any of RF components on the page.

          B.t.w. show your web.xml. Are you sure you properly defined filters there?

          • 2. Re: Problem with t:inputFileUpload in one page with t:dataSc

            I don't think that the problem is with richfaces, but it was first discovered after a4j components was involved. Maybe it's a configuration error, or MyFaces 1.2.3 bug...

            In all the other pages dataTables with scrollers and all the others work fine.
            The exception is thrown only on uploaded file sumit %(.

            web.xml contains nothing unusual:

            <context-param>
             <param-name>com.sun.faces.verifyObjects</param-name>
             <param-value>false</param-value>
             </context-param>
             <context-param>
             <param-name>com.sun.faces.validateXml</param-name>
             <param-value>true</param-value>
             </context-param>
             <context-param>
             <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
             <param-value>client</param-value>
             </context-param>
            
            
             <context-param>
             <param-name>org.richfaces.SKIN</param-name>
             <param-value>blueSky</param-value>
             </context-param>
            
             <filter>
             <display-name>RichFaces Filter</display-name>
             <filter-name>richfaces</filter-name>
             <filter-class>org.ajax4jsf.Filter</filter-class>
             </filter>
            
             <filter-mapping>
             <filter-name>richfaces</filter-name>
             <servlet-name>Faces Servlet</servlet-name>
             <dispatcher>REQUEST</dispatcher>
             <dispatcher>FORWARD</dispatcher>
             <dispatcher>INCLUDE</dispatcher>
             </filter-mapping>
            
             <filter>
             <filter-name>extensionsFilter</filter-name>
             <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
             <init-param>
             <param-name>uploadMaxFileSize</param-name>
             <param-value>100m</param-value>
             </init-param>
             </filter>
             <filter-mapping>
             <filter-name>extensionsFilter</filter-name>
             <url-pattern>/faces/*</url-pattern>
             </filter-mapping>
             <servlet>
             <servlet-name>Faces Servlet</servlet-name>
             <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
             <load-on-startup>2</load-on-startup>
             </servlet>
            


            Maybe I should add the POST method?

            • 3. Re: Problem with t:inputFileUpload in one page with t:dataSc

              Sorry, the last phrase was posted by mistake.

              P.S. Even forcedId="true" didn't help in my case.

              • 4. Re: Problem with t:inputFileUpload in one page with t:dataSc
                ilya_shaikovsky

                Please change your extension filter mapping definition. Map it to Faces Servlet by name instead url pattern usage.

                • 5. Re: Problem with t:inputFileUpload in one page with t:dataSc

                   

                  "ilya_shaikovsky" wrote:
                  Please change your extension filter mapping definition. Map it to Faces Servlet by name instead url pattern usage.


                  But what about resources?
                  Without path "*" mapping only pages can be rendered:

                  "Exception while calling encodeEnd on component : {Component-Path : [Class: org.ajax4jsf.component.AjaxViewRoot,ViewId: /secure/IpResolver1.jsp][Class: javax.faces.component.html.HtmlPanelGrid,Id: j_id_jsp_457317036_12]}

                  Caused by:
                  java.lang.IllegalStateException - ExtensionsFilter not correctly configured. Resource mapping missing. Resources cant be delivered. Please see: http://myfaces.apache.org/tomahawk/extensionsFilter.html'

                  Maybe I should use both mappings?