10 Replies Latest reply on Oct 10, 2007 2:42 PM by Waseem Quraishi

    boolean property not binding

    Selcuk Bozdag Newbie

      Hi,

      I have a page as below:

       <!-- mypage.xhtml -->
      
       <ice:form id="someFormId">
       ...
       <h:selectBooleanCheckbox id="containsHeader"
       value="#{bean.checked}"/>
       ...
       </ice:form>
      
      


      I am trying to show a check box component on the page. And here is my "stateful" session bean,

      @Stateful
      @Scope(ScopeType.SESSION)
      @Name("bean")
      public class MyBean implements Serializable, IMyBean{
      
       @In boolean checked;
       // other properties
       public String someAction() {
       //...
       return "someOutcome";
       }
      
       @Remove
       public void destroy() {
       }
      }
      


      I am getting this error message while trying to load mypage.xhtml given above.


      Exception during request processing:
      Caused by javax.faces.FacesException with message: "Problem in renderResponse: javax.el.PropertyNotFoundException: /mypage.xhtml @35,74 value="#{bean.checked}": Property 'checked' not found on type org.javassist.tmp.java.lang.Object_$$_javassist_2"



      What do you think that why the error occurs?

      Thanks

        • 1. Re: boolean property not binding
          Stuart Douglas Master

          You need to add getters and setter for checked to both MyBean and IMyBean.

          • 2. Re: boolean property not binding
            Selcuk Bozdag Newbie

            Thanks. I added getters and setters methods to both files by now. Error message has changed to:

            Exception during request processing:
            Caused by javax.faces.FacesException with message: "Problem in renderResponse: javax.el.ELException: /mypage.xhtml @35,75 value="#{bean.checked}": Error reading 'checked' on type org.javassist.tmp.java.lang.Object_$$_javassist_2"


            And this is the stack trace:

            com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:324)
            com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
            com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
            com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
            com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
            com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
            com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:143)
            com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
            com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
            com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:46)
            com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
            com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
            com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
            com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
            com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:109)
            com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
            com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
            com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
            com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:98)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
            org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
            org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
            org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
            org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
            org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
            org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
            org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
            org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
            org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            java.lang.Thread.run(Thread.java:595)


            I read through the JBoss Seam book but I could not find anything saying I am doing wrong. But, what am I missing?

            cheers


            • 3. Re: boolean property not binding
              Stuart Douglas Master

              Can you post the full stacktrace? The one you posted is incomplete.

              • 4. Re: boolean property not binding
                Selcuk Bozdag Newbie

                Hmm... There are also more stack trace lines. Do they make any sense?

                Caused by org.jboss.seam.RequiredException with message: "@In attribute requires non-null value: bean.checked"

                org.jboss.seam.Component.getValueToInject(Component.java:2173)
                org.jboss.seam.Component.injectAttributes(Component.java:1603)
                org.jboss.seam.Component.inject(Component.java:1421)
                org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
                org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
                org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
                org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
                org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
                org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
                tmrc.gexpress.beans.entity.ResultsFile_$$_javassist_2.isChecked(ResultsFile_$$_javassist_2.java)
                sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                java.lang.reflect.Method.invoke(Method.java:585)
                javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
                javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
                com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
                org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
                org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
                org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
                com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
                javax.faces.component.UIOutput.getValue(UIOutput.java:173)
                com.icesoft.faces.renderkit.dom_html_basic.DomBasicInputRenderer.getValue(DomBasicInputRenderer.java:60)
                com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.getValue(DomBasicRenderer.java:153)
                com.icesoft.faces.renderkit.dom_html_basic.CheckboxRenderer.encodeBegin(CheckboxRenderer.java:106)
                javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
                com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:340)
                com.icesoft.faces.renderkit.dom_html_basic.GridRenderer.encodeChildren(GridRenderer.java:196)
                javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:342)
                com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:348)
                com.icesoft.faces.renderkit.dom_html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:92)
                javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:561)
                com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:565)
                com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:317)
                com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:153)
                com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
                com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:143)
                com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet$ThreadBlockingRequestResponse.respondWith(ThreadBlockingAdaptingServlet.java:36)
                com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
                com.icesoft.faces.webapp.http.core.SingleViewServer.service(SingleViewServer.java:46)
                com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer$Matcher.serviceOnMatch(PathDispatcherServer.java:50)
                com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:19)
                com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
                com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:29)
                com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:109)
                com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
                com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
                com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
                com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:98)
                javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                java.lang.Thread.run(Thread.java:595)


                cheers

                • 5. Re: boolean property not binding
                  Stuart Douglas Master

                  The problem is with the @In, your component 'checked' cannot be injected. try @In(create=true) and you might see some improvement.

                  I must admit though I have never tried to inject a primitive, I have a feeling that this will not work.

                  • 6. Re: boolean property not binding
                    Selcuk Bozdag Newbie

                    Thanks anyway. Although I tried @In(create=true), it did not work for me..

                    So, I think that this should be a very trivial thing for framework to work with primitive data types.

                    What should I try next do you think?

                    • 7. Re: boolean property not binding
                      Stuart Douglas Master

                      Why do you want a scoped boolean anyway? It seems a bit odd to me.

                      Are you sure you actually want to inject this boolean and not just have it bound to the check box on the page? If this is the case then remove the @In annotation and everything should work ok.

                      • 8. Re: boolean property not binding
                        Selcuk Bozdag Newbie

                        probably you're right! thanks.

                        I now don't use @In annotation and it works. I am new to seam and trying to realize when to use @In and @Out ? Since I am not a pragmatic programmer yet, I sometimes program blindly. Could you please tell me the idea of @In and @Out in brief? (if you have enough time to type a few words) AFAIK, seam is not ejb3. So I feel a little bit inconfident while programming in seam.

                        thanks.

                        • 9. Re: boolean property not binding
                          Stuart Douglas Master

                          You need to read the docs and look at the examples. Dependency injection of seam components is pretty core to the framework, and it is a bit to much to re-type here.

                          • 10. Re: boolean property not binding
                            Waseem Quraishi Newbie

                            i had to change my model to get boolean values to work right, by specifying the actual column type:

                            @Column(updatable = true, name = "featured_listing", columnDefinition = "TINYINT")
                            public boolean isFeaturedListing() {
                            return featuredListing;
                            }