11 Replies Latest reply on Sep 20, 2007 11:55 AM by Alex Ka

    <a:support> with <s:selectItems> problem

    Christopher no Newbie

      Hi,

      what I am trying to do is to change the set of values in one <s:selectItems> component after changing the value on a facelets page in another <s:selectItems>. In other words speaking lets assume that we have two <s:selectItems> components. In the first one there are branches and in the second one there are categories. And now if I change the branch the categories in the new selected branch should be loaded into the second <s:selectItems> . The code is following:


      <h:form id="predefinedSkill" styleClass="edit">
      
       <h:outputLabel for="branch">
       #{messages.branch}
       </h:outputLabel>
      
       <s:decorate id="branchDecoration">
       <h:selectOneMenu value="#{branchHome.instance.name}">
       <s:selectItems value="#{branchList.resultList}" var="branch" label="#{branch.name}" />
       <s:convertEntity/>
       <a:support event="onchange" reRender="categoryDecoration" ajaxSingle="true" action="#{categoryHome.loadAllCategories()}"/>
       </h:selectOneMenu>
       </s:decorate>
      
      
       <h:outputLabel for="category">
       #{messages.category}
       </h:outputLabel>
      
       <s:decorate id="categoryDecoration">
       <h:selectOneMenu value="#{categoryHome.instance.name}" >
       <s:selectItems value="#{categoryHome.categoryList}" var="category" label="#{category.name}" />
       <s:convertEntity/>
       </h:selectOneMenu>
       </s:decorate>
      
      </h:form>
      


      But when I change the branch I get the error:
      INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=predefinedSkill:branchDecoration:j_id29[severity=(ERROR 2), summary=(/specialist/spec_skills.xhtml @76,85 value="#{branchHome.instance.name}": java.lang.IllegalArgumentException: argument type mismatch), detail=(/specialist/spec_skills.xhtml @76,85 value="#{branchHome.instance.name}": java.lang.IllegalArgumentException: argument type mismatch)]
      
      


      If the Branch Entity has additionally constraints on length i.e.
      @Column(name = "NAME", length = 100)
      @Length(max = 100)
      public String getName() {
       return this.name;
      }
      


      I get the following error:

      INFO [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
      sourceId=predefinedSkill:branchDecoration:j_id28[severity=(ERROR 2), summary=(length must be between 0 and 100), detail=(length must be between 0 and 100)]
      sourceId=predefinedSkill:predefinedSkillDecoration:j_id37[severity=(ERROR 2), summary=(length must be between 0 and 100), detail=(length must be between 0 and 100)]
      


      In both cases the method categoryHome.loadAllCategories() [I don't use branchId as a parameter in this method for the simplicity reason] is not invoked! But if I invoke it from the simple <h:input> component:
      <h:form id="predefinedSkill" styleClass="edit">
      
       <h:inputText value="TEST">
       <a:support event="onchange" reRender="categoryDecoration" ajaxSingle="true" action="#{categoryHome.loadAllCategories()}"/>
       </h:inputText>
      
       <h:outputLabel for="branch">
       #{messages.branch}
       </h:outputLabel>
      
       <s:decorate id="branchDecoration">
       <h:selectOneMenu value="#{branchHome.instance.name}">
       <s:selectItems value="#{branchList.resultList}" var="branch" label="#{branch.name}" />
       <s:convertEntity/>
       <a:support event="onchange" reRender="categoryDecoration" ajaxSingle="true" action="#{categoryHome.loadAllCategories()}"/>
       </h:selectOneMenu>
       </s:decorate>
      
      
       <h:outputLabel for="category">
       #{messages.category}
       </h:outputLabel>
      
       <s:decorate id="categoryDecoration">
       <h:selectOneMenu value="#{categoryHome.instance.name}" >
       <s:selectItems value="#{categoryHome.categoryList}" var="category" label="#{category.name}" />
       <s:convertEntity/>
       </h:selectOneMenu>
       </s:decorate>
      
      </h:form>
      


      everything works fine. Could anybody explain me why there is such a problem with <s:selectItems> and what are possible solutions for that.

      Thanks for help in advance.
      (I use Seam 2 CR1 + JBoss AS 4.2.0)

      Best regards,
      jquery

        • 1. Re: <a:support> with <s:selectItems> problem
          Alex Ka Novice

          The first selectOneMenu mus be in a:region and the second one in a:outputPanel (ajaxRendered=true). Ids must be set for those components and not s:decorate.

          This is more of a A4J problem...

          • 2. Re: <a:support> with <s:selectItems> problem
            Pete Muir Master

            Also, the value of the h:selectXXX doesn't want to be a String, but the entity setter if you are using s:convertEntity. Try to get this working without ajax to start with.

            • 3. Re: <a:support> with <s:selectItems> problem
              Alex Ka Novice

              After I noticed that your question has more in it than what my reply was I would add that according to the docs ajaxSingle="true" submits ONLY one field/link, instead of all form controls.

              So when you put a:support on the selectOneMenu and you don't have region/outputPanel it messes up. When you put it on the text field it's ok.

              • 4. Re: <a:support> with <s:selectItems> problem
                Christopher no Newbie

                Hi,

                @wise_guybg

                yes, I don't need to use a:region and a:outputPanel. It should work with <s:decorate> :)

                @pete.muir@jboss.org

                I changed #{branchHome.instance.name} in h:selectXXX into #{branchHome.instance.id} but then I get the following error:

                [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
                sourceId=predefinedSkill:j_id29[severity=(ERROR 2), summary=(/specialist/spec_skills.xhtml @76,83 value="#{branchHome.instance.id}": java.lang.IllegalArgumentException: argument type mismatch), detail=(/specialist/spec_skills.xhtml @76,83 value="#{branchHome.instance.id}": java.lang.IllegalArgumentException: argument type mismatch)]
                


                But when I change #{branchHome.instance.name} in h:selectXXX into #{branchHome.id} [without "instance"] the method #{categoryHome.loadAllCategories()} is invoked. I don't uderstand in this case what is the difference between #{branchHome.instance.id} and #{branchHome.id}. Could you explain that behaviour, please?


                And the second question is how can I invoke #{categoryHome.loadAllCategories() method with branchHome.id parameter? If I invoke the following method #{categoryHome.loadCategoriesByBranchId(branchHome.id)} I get he following error:

                WARN [lifecycle] Cannot convert isiok.data.entitybeans.Branch@190de90 of type class isiok.data.entitybeans.Branch to long
                java.lang.IllegalArgumentException: Cannot convert isiok.data.entitybeans.Branch@190de90 of type class isiok.data.entitybeans.Branch to long
                 at org.jboss.el.lang.ELSupport.coerceToNumber(ELSupport.java:271)
                 at org.jboss.el.lang.ELSupport.coerceToType(ELSupport.java:331)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:321)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)
                 at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
                 at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
                 at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                 at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                 at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
                 at javax.faces.component.UICommand.broadcast(UICommand.java:383)
                 at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
                 at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
                 at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
                 at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
                 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Unknown Source)
                14:35:57,500 WARN [lifecycle] executePhase(INVOKE_APPLICATION 5,com.sun.faces.context.FacesContextImpl@3e93aa) threw exception
                javax.faces.FacesException: Cannot convert isiok.data.entitybeans.Branch@190de90 of type class isiok.data.entitybeans.Branch to long
                 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:105)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Unknown Source)
                Caused by: java.lang.IllegalArgumentException: Cannot convert isiok.data.entitybeans.Branch@190de90 of type class isiok.data.entitybeans.Branch to long
                 at org.jboss.el.lang.ELSupport.coerceToNumber(ELSupport.java:271)
                 at org.jboss.el.lang.ELSupport.coerceToType(ELSupport.java:331)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:321)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)
                 at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
                 at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
                 at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                 at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                 at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
                 at javax.faces.component.UICommand.broadcast(UICommand.java:383)
                 at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
                 at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
                 at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
                 at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
                 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
                 ... 40 more
                14:35:57,562 ERROR [ExceptionFilter] handling uncaught exception
                javax.servlet.ServletException: Cannot convert isiok.data.entitybeans.Branch@190de90 of type class isiok.data.entitybeans.Branch to long
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Unknown Source)
                Caused by: java.lang.IllegalArgumentException: Cannot convert isiok.data.entitybeans.Branch@190de90 of type class isiok.data.entitybeans.Branch to long
                 at org.jboss.el.lang.ELSupport.coerceToNumber(ELSupport.java:271)
                 at org.jboss.el.lang.ELSupport.coerceToType(ELSupport.java:331)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:321)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)
                 at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
                 at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
                 at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                 at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                 at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
                 at javax.faces.component.UICommand.broadcast(UICommand.java:383)
                 at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
                 at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
                 at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
                 at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
                 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                 ... 37 more
                14:35:57,625 ERROR [ExceptionFilter] exception root cause
                java.lang.IllegalArgumentException: Cannot convert isiok.data.entitybeans.Branch@190de90 of type class isiok.data.entitybeans.Branch to long
                 at org.jboss.el.lang.ELSupport.coerceToNumber(ELSupport.java:271)
                 at org.jboss.el.lang.ELSupport.coerceToType(ELSupport.java:331)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:321)
                 at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)
                 at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
                 at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
                 at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
                 at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
                 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                 at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                 at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
                 at javax.faces.component.UICommand.broadcast(UICommand.java:383)
                 at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
                 at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:186)
                 at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:164)
                 at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:352)
                 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                 at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                 at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                 at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                 at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                 at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                 at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                 at java.lang.Thread.run(Unknown Source)
                


                But id variable in Branch Entity is type of long. What is the problem?



                • 5. Re: <a:support> with <s:selectItems> problem
                  Alex Ka Novice

                  Well, no. Using a:region and a:outputPanel is the way to do it. I think you have misunderstood the points I have made.

                  Also, as Pete stated, when you use convertEntity you should set/get the value as an entity. So it would be correct to have #{branchHome.instance}. This means when the user selects an item it will be converted to entity Branch and will be set for the Home object.

                  • 6. Re: <a:support> with <s:selectItems> problem
                    Brian Smith Apprentice

                    I don't think a:region is necessary but a:outputPanel is

                    Just make sure you have any selectOneMenus that are rerendered inside of a:outputPanel.

                    • 7. Re: <a:support> with <s:selectItems> problem
                      Christopher no Newbie

                      Yes, it should be #{branchHome.instance}. Thanks a lot for the help. And now invoking #{categoryHome.loadCategoriesByBranchId(branchHome.instance.id)} method works fine :)

                      But I still don't understand why I should use a:region and a:outputPanel. I don't use any of them and the second selectOneMenu is refreshed without a problem after the loadCategoriesByBranchId(branchHome.instance.id) method is invoked. Could you explain the aim of using that components in detail, please?

                      • 8. Re: <a:support> with <s:selectItems> problem
                        Brian Smith Apprentice

                        I use a:outputPanel because I have had trouble getting individual components to rerender on their own. I know its supposed to work without it but I use what works for me.

                        I would love to hear from others on this.

                        • 9. Re: <a:support> with <s:selectItems> problem
                          Alex Ka Novice

                          It's ajaxSingle="true" that helps you run your code without following recommendations.

                          In my view a:outputPanel optimizes the AJAX requiest since:

                          The component is used for components grouping in the AJAX output area, which offers several additional output opportunities such as inserting of non-present in tree components, saving of transient elements after AJAX request and some others.


                          Reference:
                          http://labs.jboss.com/file-access/default/members/jbossajax4jsf/freezone/docs/devguide/en/html_single/index.html#outputPanel

                          What you do with ajaxSingle is that you submit only the changes to the combo box. I'm actually amazed that A4J manages to update the page correctly. I guess though that it updates the whole page while with a:outputPanel you can update only the second combo box.

                          • 10. Re: <a:support> with <s:selectItems> problem
                            Christopher no Newbie

                            @wise_guybg

                            Thank you for your explanation. I conducted an experiment placing the third selectOneMenu (also with categoryList) on a page but not specifying it in reRender parameter of <a:support>. After loadCategoriesByBranchId() method was called only one selectOneMenu was refreshed (the specified in reRender). So it seems that only the part of a page is refreshed.

                            • 11. Re: <a:support> with <s:selectItems> problem
                              Alex Ka Novice

                              I guess A4T is incredible :)

                              One must spend more time reading articles and the reference manual :)