7 Replies Latest reply on Jun 27, 2007 1:24 AM by Vitaly Rudensky

    rich:dataTable with h:inputText   a bug ?

    Vitaly Rudensky Newbie

      There is a list which contains elements of Class1 and Class2. A need to show it in rich:dataTable.
      I've got such code in page

      <rich:dataTable ... var="item">
       ....
      <rich:column>
       <h:inputText value ="#{item.someProperty}" rendered="#{item.class.simpleName eq 'Class1'}" />
       <rich:spacer rendered="#{item.class.simpleName eq 'Class2'}" />
      </rich:column>
      
      
      <rich:column>
       <h:outputText value ="#{item.someProperty}" rendered="#{item.class.simpleName eq 'Class1'}" />
       <rich:spacer rendered="#{item.class.simpleName eq 'Class2'}" />
      </rich:column>
      ...
      </rich:dataTable>
      


      Everything works fine for h:outputText
      For h:inputText I get error like this:
      javax.faces.el.PropertyNotFoundException: ... value="#{item.someProperty}" ... Bean: Class2, property: someProperty
      


      Environment:
      facelets 1.1.12
      ajax4jsf 1.1.0
      richfaces 3.0.0
      seam 1.1.6.GA


        • 1. Re: rich:dataTable with h:inputText   a bug ?
          Damian Harvey Master

          I don't have a problem with inputText inside a datatable. Show us your bean.

          • 2. Re: rich:dataTable with h:inputText   a bug ?
            Vitaly Rudensky Newbie


            Data classes:

            //Base class
            public class BaseItem implements Serializable {
            }
            
            public class FooItem extends BaseItem implements Serializable {
             private String foo ="fooValue";
             public String getFoo() {
             return foo;
             }
             public void setFoo(String foo) {
             this.foo = foo;
             }
            }
            public class BarItem extends BaseItem implements Serializable {
             private String bar="barValue";
             public String getBar() {
             return bar;
             }
             public void setBar(String bar) {
             this.bar = bar;
             }
            }
            

            Seam action Bean
            @Name("testAction")
            @Scope(ScopeType.SESSION)
            public class TestBean implements Serializable {
             @Out
             private List<BaseItem> baseItemsList;
             public void generateList() {
             baseItemsList=new ArrayList(2);
             baseItemsList.add(new FooItem());
             baseItemsList.add(new BarItem());
             }
            }
            


            xhtml code. Try to uncomment h:inputText
             <a4j:region>
             <h:form>
             <rich:dataTable value="#{baseItemsList}" var="item" id="itemsTable">
             <f:facet name="header">
             <rich:column>Test</rich:column>
             </f:facet>
             <rich:column>
             <h:outputText value="#{item.bar}" rendered="#{item.class.simpleName eq 'BarItem'}"/>
             <!-- error if uncomment next line -->
             <!-- h:inputText value="#{item.foo}" rendered="#{item.class.simpleName eq 'FooItem'}"/ -->
             <h:outputText value="#{item.foo}" rendered="#{item.class.simpleName eq 'FooItem'}"/>
             </rich:column>
             </rich:dataTable>
             <a4j:commandButton value="Generate" action="#{testAction.generateList}" reRender="itemsTable" />
             </h:form>
             </a4j:region>
            



            • 3. Re: rich:dataTable with h:inputText   a bug ?
              Vitaly Rudensky Newbie

              It looks like a bug. For h:dataTable everything works fine.

              Test xhtml for the same classes:

               <a4j:region>
               <h:form>
               <h:dataTable var="item" value="#{baseItemsList}" id="jsfTable">
               <h:column>
               <f:facet name="header">Test</f:facet>
               <h:column>
               <h:inputText value="#{item.foo}" rendered="#{item.class.simpleName eq 'FooItem'}"/>
               <h:outputText value="#{item.bar}" rendered="#{item.class.simpleName eq 'BarItem'}"/>
               </h:column>
               </h:column>
               </h:dataTable>
              
               <rich:dataTable value="#{baseItemsList}" var="item" id="richTable">
               <f:facet name="header">
               <rich:column>Test</rich:column>
               </f:facet>
               <rich:column>
               <!-- error if uncomment next line -->
               <!-- h:inputText value="#{item.foo}" rendered="#{item.class.simpleName eq 'FooItem'}"/ -->
               <h:outputText value="#{item.bar}" rendered="#{item.class.simpleName eq 'BarItem'}"/>
               <h:outputText value="#{item.foo}" rendered="#{item.class.simpleName eq 'FooItem'}"/>
               </rich:column>
               </rich:dataTable>
              
               <a4j:commandButton value="Generate" action="#{testAction.generateList}" reRender="jsfTable,richTable" />
               </h:form>
               </a4j:region>
              


              • 5. Re: rich:dataTable with h:inputText   a bug ?
                Alexej Newbie

                issue updated in Jira. See latest comments.

                • 6. Re: rich:dataTable with h:inputText   a bug ?
                  Vitaly Rudensky Newbie

                   


                  It's not a bug. This problem occurs because of coment tag (<!-- -->) presents inside the dataTable on facelets page.
                  To avoid this problem use <ui:remove> insteat of coment tag, or add following context param to web.xml
                  <context-param>
                  <param-name>facelets.SKIP_COMMENTS</param-name>
                  <param-value>true</param-value>
                  </context-param>

                  Problem still exists even if I remove all comments.
                  BTW facelets.SKIP_COMMENTS setted to True in my project.
                  See source codes posted above.
                  I've got exception:
                  SEVERE: Error Rendering View[/pages/test.xhtml]
                  javax.faces.el.PropertyNotFoundException: /pages/test.xhtml @31,92 value="#{item.foo}": Bean: com.azovstal.cbt.test.BarItem, property: foo
                   at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
                   at javax.faces.component.UIOutput.getValue(UIOutput.java:77)
                   at org.ajax4jsf.ajax.repeat.UIDataAdaptor$SavedState.populate(UIDataAdaptor.java:1006)
                   at org.ajax4jsf.ajax.repeat.UIDataAdaptor.saveChildState(UIDataAdaptor.java:722)
                   at org.ajax4jsf.ajax.repeat.UIDataAdaptor.saveChildState(UIDataAdaptor.java:728)
                   at org.ajax4jsf.ajax.repeat.UIDataAdaptor.saveChildState(UIDataAdaptor.java:700)
                   at org.ajax4jsf.ajax.repeat.UIDataAdaptor.setRowKey(UIDataAdaptor.java:282)
                   at org.ajax4jsf.ajax.repeat.UIDataAdaptor.setRowKey(UIDataAdaptor.java:265)
                   at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:94)
                   at org.richfaces.renderkit.AbstractRowsRenderer.encodeChildren(AbstractRowsRenderer.java:124)
                   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
                   at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:252)
                   at org.richfaces.renderkit.AbstractRowsRenderer.encodeCellChildren(AbstractRowsRenderer.java:252)
                   at org.richfaces.renderkit.AbstractTableRenderer.encodeOneRow(AbstractTableRenderer.java:168)
                   at org.richfaces.renderkit.AbstractRowsRenderer.process(AbstractRowsRenderer.java:75)
                   at org.ajax4jsf.ajax.repeat.SequenceDataModel.walk(SequenceDataModel.java:101)
                   at org.ajax4jsf.ajax.repeat.UIDataAdaptor.walk(UIDataAdaptor.java:855)
                   at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:92)
                   at org.richfaces.renderkit.AbstractRowsRenderer.encodeChildren(AbstractRowsRenderer.java:124)
                   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:524)
                   at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:252)
                   at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:127)
                   at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
                   at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
                   at org.ajax4jsf.framework.renderer.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:125)
                   at org.ajax4jsf.ajax.UIAjaxRegion.encodeAjax(UIAjaxRegion.java:245)
                   at org.ajax4jsf.framework.ajax.AjaxViewRoot$4.invoke(AjaxViewRoot.java:355)
                   at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:78)
                   at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:83)
                   at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
                   at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
                   at org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:382)
                   at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:244)
                   at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
                   at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                   at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
                   at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:38)
                   at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:129)
                   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
                   at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                   at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                   at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
                   at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
                   at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:96)
                   at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
                   at com.azovstal.security.auth.AzovstalAuthenticator.invoke(AzovstalAuthenticator.java:76)
                   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                   at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                   at java.lang.Thread.run(Thread.java:619)
                  


                  • 7. Re: rich:dataTable with h:inputText   a bug ?
                    Vitaly Rudensky Newbie

                    Problem solved switching to new versions of a4j (1.1.1) and rf (3.0.1)
                    Thanks.