6 Replies Latest reply: Jul 12, 2012 11:17 AM by Javier M RSS

pickList right side

Javier M Newbie

Hello everybody

 

When I try to paint into the right part of a pickList I'm getting the next error

 

 

SEVERE: Value expression must evaluate to either a List or Object[]
java.lang.IllegalArgumentException: Value expression must evaluate to either a List or Object[]
          at org.richfaces.renderkit.SelectManyHelper.getClientSelectItems(SelectManyHelper.java:238)
          at org.richfaces.renderkit.SelectManyRendererBase.getClientSelectItems(SelectManyRendererBase.java:60)
          at org.richfaces.renderkit.html.PickListRenderer.encodeEnd(PickListRenderer.java:202)
          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
          at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
          at org.richfaces.renderkit.html.PanelRenderer.encodeEnd(PanelRenderer.java:181)
          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
          at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
          at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
          at org.richfaces.renderkit.html.PopupPanelRenderer.encodeEnd(PopupPanelRenderer.java:534)
          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
          at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
          at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
          at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
          at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
          at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:304)
          at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
          at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
          at org.richfaces.renderkit.html.AjaxOutputPanelRenderer.encodeChildren(AjaxOutputPanelRenderer.java:57)
          at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
          at org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:504)
          at org.richfaces.context.RenderExtendedVisitContext.invokeVisitCallbackForImplicitComponent(RenderExtendedVisitContext.java:70)
          at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:333)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1612)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
          at javax.faces.component.UIForm.visitTree(UIForm.java:371)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
          at javax.faces.component.UIComponent.visitTree(UIComponent.java:1623)
          at org.richfaces.context.ExtendedPartialViewContextImpl.processPartialRenderPhase(ExtendedPartialViewContextImpl.java:272)
          at org.richfaces.context.ExtendedPartialViewContextImpl.processPartial(ExtendedPartialViewContextImpl.java:194)
          at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
          at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:409)
          at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125)
          at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
          at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
          at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
          at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
          at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at org.primefaces.webapp.filter.FileUploadFilter.doFilter(FileUploadFilter.java:79)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:343)
          at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
          at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:188)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:109)
          at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:355)
          at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:149)
          at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
          at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
          at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
          at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
          at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
          at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
          at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
          at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
          at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
          at java.lang.Thread.run(Thread.java:680)

 

To populate the pick list I use a service for the left side, which retrieves a Collection<Elements>, all the different elements which I have into the DB. To populate the right side I'm using a bean which contains several fileds. One of them is a Collection<Elements>. I dont know why it is working for the left part but no for the right part. The converter works good, because it's coverting from Element to String

 

Here is my code

 

<div class="manage-section-row">
     <rich:panel style="width:560px;">
          <f:facet name="header">
               <h:outputText value="User Authorities"></h:outputText>
          </f:facet>
          <rich:pickList value="#{userToModifyBean.elements}" sourceCaption="Available Elements" targetCaption="Selected Authorities" listWidth="165px" listHeight="100px" orderable="true">
               <f:selectItems value="#{userService.allElements}" var="elem" itemValue="#{elem}" itemLabel="#{elem.element}" />
               <f:converter converterId="ElementsConverter" />
          </rich:pickList>
     </rich:panel>
</div>

  • 1. Re: pickList right side
    Brendan Healey Master

    I think just ensuring that allElements is a List<Something>, and perhaps just <f:selectItems value="#{userService.allElements}"/>

    It's not clear where #{elem} is coming from when you have var="auth".

     

    Regards,

    Brendan.

  • 2. Re: pickList right side
    Jan Papousek Newbie

    Since the right side is orderable, the model has to preserve order and the rich:pickList@value attribute has to point to List or array.

  • 3. Re: pickList right side
    Javier M Newbie


    Brendan Healey wrote:

     

    I think just ensuring that allElements is a List<Something>, and perhaps just <f:selectItems value="#{userService.allElements}"/>

    It's not clear where #{elem} is coming from when you have var="auth".

     

    Regards,

    Brendan.

    Sorry Brendan. It was my fault. Its already fixed. In code the var was good. It was a mistake during the copy paste here.

  • 4. Re: pickList right side
    Javier M Newbie

    Jan Papousek wrote:

     

    Since the right side is orderable, the model has to preserve order and the rich:pickList@value attribute has to point to List or array.

    If I understood good both sides has to point to a List or array. In my case both of them are pointing to a Collection<Element>. But Its only working good for the left side. Even if i set it as non orderable, is not working.

     

    BTW In this case the values for the right side and the left side are the same. Is that a problem?

  • 5. Re: pickList right side
    Brendan Healey Master

    Javier, you need to use the List interface not the Collection interface. I missed the orderable="true" far over on the right hand

    side but Jan's comment looks good. As for the values on the left and right being the same, that doesn't sound too good to me.

    I'd expect you to have unselected items on the left and selected items on the right so I don't see how something can be

    selected and unselected at the same time.

     

    To do this the rich:picklList value= expression should reference a List of the selected items, and f:selectItems value= should

    point to both the unselected and selected items. The pickList component figures out what is unselected from this data.

     

    Regards,

    Brendan.

  • 6. Re: pickList right side
    Javier M Newbie

    Brendan Healey wrote:

     

    Javier, you need to use the List interface not the Collection interface. I missed the orderable="true" far over on the right hand

    side but Jan's comment looks good. As for the values on the left and right being the same, that doesn't sound too good to me.

    I'd expect you to have unselected items on the left and selected items on the right so I don't see how something can be

    selected and unselected at the same time.

     

    To do this the rich:picklList value= expression should reference a List of the selected items, and f:selectItems value= should

    point to both the unselected and selected items. The pickList component figures out what is unselected from this data.

     

    Regards,

    Brendan.

    Thank you Brendan. You were right. The problem was the Collection. It has to be a List.

     

    About having the same values for both lists. It's only because I was testing with a copule of values and I populate the second list with all the values (the two). Usually the right list will only one or some values from the list in the left.

     

    TY all of you.