1 2 Previous Next 23 Replies Latest reply on Nov 22, 2006 7:13 AM by pmuir Go to original post
      • 15. Re: UPDATED: SelectItems (the one with the EntityConverter)
        fonseca

        Hello Peter,

        I'm having a few troubles using your component, could you please help me out? I'm using the 1.1.1beta1 release, and my problem arises from using the following jsf structure (I'll filter out everything unimportant):

         <t:dataTable var="var"
         rowIndexVar="i"
         value="#{ list }">
        
         <h:column>
         <h:commandLink action="#{ someBean.edit }" immediate="true" value="edit"/>
         </h:column>
        
         <h:column>
         <h:outputText value="#{ var.somefield }" rendered="#{ index != i }"/>
         <h:selectOneMenu value="#{ current.somefield }" rendered="#{ index == i }">
         <si:selectItems value="#{ combo }" var="v" label="#{ v.somefield }"/>
         </h:selectOneMenu>
         </h:column>
         </t:dataTable>
        


        I understand if this code appears a bit unusual, the point is to have both viewing and editing on the same table. The 'edit' method will, among a few other things, set the seam context variable 'index' to the position in the list of the selected item, as to have the second clause 'rendered' return true so to show the selectbox.

        I've been working with such pattern, and it behaved nicely using f:selectItems and binding the values to strings. Upon switching to si:selectItems, however, I now get the following error as soon as entering the page:

        javax.faces.el.PropertyNotFoundException: /WEB-INF/test.xhtml @50,118 value="#{ current.somefield }": Target Unreachable, identifier 'current' resolved to null
         at com.sun.facelets.el.LegacyValueBinding.getType(LegacyValueBinding.java:96)
         at org.jboss.seam.selectitems.jsf.SelectItemsComponentHandler.addConverters(SelectItemsComponentHandler.java:64)
         at org.jboss.seam.selectitems.jsf.SelectItemsComponentHandler.onComponentCreated(SelectItemsComponentHandler.java:237)
         at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:161)
         at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)
         at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)
         at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
         at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)
         at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)
         at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.j
        ...
        


        The outjected object 'current' is set only after the 'edit' method is invoked. So it makes sense that such error would occur if I was trying to show the combo upon first entering the page. Note, though, that the 'rendered' clause will return false in this occasion - i only want to see the combo after calling 'edit'. It seems si:selectItems attempts to evaluate the value of my h:selectOneMenu, whether or not it should be rendered, and it ends up breaking the code. Is there any way to achieve the behavior I want?

        Much obliged,
        Luis


        • 16. Re: UPDATED: SelectItems (the one with the EntityConverter)
          pmuir

          Hi Luis

          Thanks for the feedback. I discovered a similar problem when putting a si:selectitems in a datatable [1]. As I mentioned above I've been further refactoring the code to support JSP as well as facelets - a side of effect of this refactoring is that it (for me) solves the problem [2]. I hope to put out the new code in a couple of days time.

          [1] In beta1 the handler executes the parent's value binding so that it can try to guess which converter to attach. I put this code in onComponentCreated, which, if you are using a dataTable/ui:repeat is before the iteration variable is available.

          [2] In the refactored version the work is done when the value binding is executed hence the problem does not arise.

          • 17. Re: UPDATED: SelectItems (the one with the EntityConverter)
            ffischer

             

            "sbublava" wrote:
            One minor glitch: SelectItemsComponentHandler imports org.jboss.cache.CacheException, which causes a java.lang.NoClassDefFoundError exception when Facelets loads the tag library unless JBoss Cache is available.

            Maybe could change the catch clauses to Exception or at least mention this requirement in the documentation.

            Thanks,
            Stephan


            I have the exact same problem, but I can't make JBoss Cache available. How can I do this?

            Regards,
            Frank

            • 18. Re: UPDATED: SelectItems (the one with the EntityConverter)
              pmuir

              I'm afraid I haven't had time to put out a new version with this bug fixed. I need to find some time to test the changes I've made.

              • 19. Re: UPDATED: SelectItems (the one with the EntityConverter)

                I integrated the selectitems-1.1.0rc2 into my project and it works great, but now I must restart jboss every time instead of being able to redeploy my application.

                I get the following exception. Any assistance would be greatly appreciated.

                15:34:58,609 ERROR [STDERR] Nov 16, 2006 3:34:58 PM com.sun.facelets.FaceletViewHandler handleRenderException
                SEVERE: Error Rendering View[/inventory/dos/transaction/search/form.xhtml]
                com.sun.facelets.tag.TagAttributeException: /WEB-INF/template/items/dos/transaction/search/form.xhtml @18,93 entityClass="pipetracker.model.state.TransactionType" object is not an instance of declaring clas
                s
                 at com.sun.facelets.tag.BeanPropertyTagRule$LiteralPropertyMetadata.applyMetadata(BeanPropertyTagRule.java:53)
                 at com.sun.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:36)
                 at com.sun.facelets.tag.MetaTagHandler.setAttributes(MetaTagHandler.java:62)
                 at com.sun.facelets.tag.jsf.ConvertHandler.apply(ConvertHandler.java:116)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)
                 at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:295)
                 at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:165)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                 at com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:60)
                 at com.sun.facelets.tag.ui.DefineHandler.apply(DefineHandler.java:58)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:128)
                 at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:306)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:279)
                 at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
                 at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                 at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                 at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                 at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
                 at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                 at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                 at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
                 at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:510)
                 at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:553)
                 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
                 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.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at pipetracker.web.servlet.HttpServletRequestTimerFilter.doFilter(HttpServletRequestTimerFilter.java:51)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                 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 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.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:495)
                 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)
                Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                 at java.lang.reflect.Method.invoke(Method.java:585)
                 at com.sun.facelets.tag.BeanPropertyTagRule$LiteralPropertyMetadata.applyMetadata(BeanPropertyTagRule.java:49)
                


                • 20. Re: UPDATED: SelectItems (the one with the EntityConverter)
                  sbublava

                   

                  "ffischer" wrote:

                  I have the exact same problem, but I can't make JBoss Cache available. How can I do this?


                  Download JBoss Cache 1.4.0.SP1 from http://labs.jboss.com/portal/jbosscache/download, and add lib-50/jboss-cache-jdk50.jar to your EAR file. That should be all (at least I can't remember doing anything else...)

                  Thanks,
                  Stephan


                  • 21. Re: UPDATED: SelectItems (the one with the EntityConverter)
                    ffischer

                    Stephan, thanks a lot for your response. I already have had the jboss-cache-jdk50.jar within the right place in the ear. It doesn't work for me. But meanwhile I have learned a lot about converters and the selectItem stuff, so I wrote something that works for me.

                    Best regards,

                    Frank

                    • 22. Re: UPDATED: SelectItems (the one with the EntityConverter)
                      pmuir

                      New version.

                      I'd really appreciate feedback on anyone using the tags in JSP (I don't use JSP normally).

                      http://wiki.jboss.org/wiki/attach?page=SeamSelectItemsNewDesign%2Fselectitems-1.1.1beta2.zip
                      http://wiki.jboss.org/wiki/attach?page=SeamSelectItemsNewDesign

                      • You really don't need to include the caching jars if you don't use caching
                      • Complete support for JSP - si:selectItems, si:convertEntity, si:convertEnum are now available and work as in facelets. Replicated the example as a JSP example to show it all working
                      • Fixed bug where si:selectItems didn't work if used inside a rendertime iterator (e.g. dataTable, ui:repeat)
                      • Split into two jars, normally you can place both in WEB-INF/lib
                      • 23. Re: UPDATED: SelectItems (the one with the EntityConverter)
                        pmuir

                        Jason,

                        I'm not sure whats going on there I'm afraid. I have no problems redeploying the examples and the two projects in which I use the SeamSelectItems myself. What versions of Seam/JBoss AS are you using?

                        1 2 Previous Next