6 Replies Latest reply on Jul 21, 2006 2:00 PM by gavin.king

    can i do this...

      I know I can use @DataModel but I want try the following and it seems logical to me but it doesn't work.

      @Name("package")
      class ... {
       @In(create=true) @Out(scope=ScopeType.CONVERSATION)
       private List<PackageEntity> packages;
      }
      


      then in my web page do this...

      <h:dataTable value="#{package.packages}" var="pkgEntity" ...
      


      I thought I could but I keep getting the following exception
      javax.faces.el.PropertyNotFoundException: /common/openPackages.xhtml @11,96 value="#{package.packages}": Bean: $Proxy526, property: packages
       at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
       at javax.faces.component.UIData.getValue(UIData.java:779)
       at javax.faces.component.UIData.createDataModel(UIData.java:545)
       at javax.faces.component.UIData.getDataModel(UIData.java:534)
       at javax.faces.component.UIData.getRowCount(UIData.java:103)
       at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeInnerHtml(HtmlTableRendererBase.java:124)
       at org.apache.myfaces.renderkit.html.HtmlTableRendererBase.encodeChildren(HtmlTableRendererBase.java:94)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:319)
       at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:557)
       at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:562)
       at com.sun.facelets.FaceletViewHandler.encodeRecursive(FaceletViewHandler.java:562)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:457)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:352)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       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 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:595)
      


      Thanks
      Eric Ray

        • 1. Re: can i do this...

          Either add some getters/setters to package or look up via #{packages} not #{package.packages}. If using #{packages} you'll probably also want to add a @Factory method somewhere to perform the inital construction of your DataModel.

          • 2. Re: can i do this...

            The docs say if you annotate the property you don't need getters and setters.

            ...from the manual...


            The next two annotations control bijection. These attributes occur on component instance variables or property accessor methods.

            @In


            I'll add G/S and see if that works.

            • 3. Re: can i do this...

              btw, i've already used the @DataModel and @Factory annotations and it all works great. i'm just exploring here to make sure i understand what it is i'm doing

              thanks.

              eric ray

              • 4. Re: can i do this...
                gavin.king

                You don't need the getter/setter because you have outjected the list as "packages". Your mistake is that you use "#{package.packages}" as the EL expression instead of just "#{packages}".

                • 5. Re: can i do this...

                  works just like you said.

                  a few thoughts...

                  so i can outject a property and reference the property directory. i thought i had to name the component with @Name and then outject the property. then i would reference as follows - component.property.

                  however, by outjecting a property, i bypass the need to access the property via the component meaning i can just access the property directly. correct?

                  i guess i'm a little unclear on the semantics of it all...

                  • 6. Re: can i do this...
                    gavin.king

                    Things that are not Seam components may be bound to Seam context variables. You just outject them. That is why @Out has a scope element. (You don't need to specify scope for components, of course.)