5 Replies Latest reply on Feb 10, 2008 10:22 PM by Nick Belaevski

    ListShuttle + CommandButton problem

    Paulo Manabe Newbie

      Hi all,

      I have commandButtons in my webpage and one listShuttle. When I click in the button Add for example my list losses the value and throw this exception: (The action called is a simple systemout to test this problem...this action isn't called...)

      javax.faces.el.PropertyNotFoundException: Bean: java.lang.String, property: name
       at org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:500)
       at org.apache.myfaces.el.PropertyResolverImpl.getPropertyDescriptor(PropertyResolverImpl.java:472)
       at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:436)
       at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:85)
       at org.apache.myfaces.custom.security.SecurityContextPropertyResolver.getValue(SecurityContextPropertyResolver.java:101)
       at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:535)
       at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
       at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
       at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
       at org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.getStringValue(RendererUtils.java:223)
       at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:69)
       at org.apache.myfaces.shared_tomahawk.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:57)
       at org.apache.myfaces.renderkit.html.ext.HtmlTextRenderer.renderNormal(HtmlTextRenderer.java:159)
       at org.apache.myfaces.renderkit.html.ext.HtmlTextRenderer.encodeEnd(HtmlTextRenderer.java:83)
       at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:286)
       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
       at org.richfaces.renderkit.ListShuttleRendererBase.encodeOneRow(ListShuttleRendererBase.java:182)
       at org.richfaces.renderkit.AbstractRowsRenderer.process(AbstractRowsRenderer.java:87)
       at org.richfaces.model.ListShuttleDataModel.walk(ListShuttleDataModel.java:57)
       at org.ajax4jsf.component.UIDataAdaptor.walk(UIDataAdaptor.java:994)
       at org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:107)
       at org.richfaces.renderkit.ListShuttleRendererBase.encodeRows(ListShuttleRendererBase.java:99)
       at org.richfaces.renderkit.html.ListShuttleRenderer.doEncodeChildren(ListShuttleRenderer.java:247)
       at org.richfaces.renderkit.html.ListShuttleRenderer.doEncodeChildren(ListShuttleRenderer.java:233)
       at org.richfaces.renderkit.ListShuttleRendererBase.encodeChildren(ListShuttleRendererBase.java:226)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:527)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:284)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:143)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:86)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:134)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxChildren(AjaxChildrenRenderer.java:86)
       at org.ajax4jsf.renderkit.AjaxChildrenRenderer.encodeAjaxComponent(AjaxChildrenRenderer.java:134)
       at org.ajax4jsf.renderkit.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:122)
       at org.ajax4jsf.component.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:553)
       at org.ajax4jsf.context.AjaxContextImpl.renderAjaxRegion(AjaxContextImpl.java:286)
       at org.ajax4jsf.context.AjaxContextImpl$2.invoke(AjaxContextImpl.java:201)
       at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:78)
       at org.ajax4jsf.context.AjaxContextImpl.invokeOnComponent(AjaxContextImpl.java:157)
       at org.ajax4jsf.context.AjaxContextImpl.renderSubmittedAjaxRegion(AjaxContextImpl.java:215)
       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:239)
       at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)


      myPage

      <h:form id="frmBulkAdjustment">
      
       <t:div styleClass="adj_bulk_types" id="divAdjTypes">
       <richfaces:listShuttle sourceValue="#{bulkAdjustment.bulkAdjustmentBean.source}" targetValue="#{bulkAdjustment.bulkAdjustmentBean.target}"
       sourceListWidth="140" targetListWidth="140" listsHeight="153" var="item" id="listAdjType"
       sourceCaptionLabel="Available" targetCaptionLabel="Selected" fastOrderControlsVisible="false"
       orderControlsVisible="false" listClass="grey_11_bold" immediate="true"
       sourceSelection="#{bulkAdjustment.bulkAdjustmentBean.freeItems}" targetSelection="#{bulkAdjustment.bulkAdjustmentBean.items}">
      
       <richfaces:column>
       <t:outputText value="#{item.name}" />
       </richfaces:column>
       </richfaces:listShuttle>
       </t:div>
      
       <t:div styleClass="adj_content_div_center" id="divFields" >
       <t:panelGrid columns="5" columnClasses="tdAlignRight" cellspacing="5" cellpadding="0">
       <t:outputLabel value="Profit Center : " for="pftInput" styleClass="grey_11"/>
       <t:panelGroup>
       <t:inputText id="pftInput" styleClass="grey_11" style="width:150px;" value="#{bulkAdjustment.searchResource.searchResourcesBean.profitCenterTyped}"/>
       <richfaces:suggestionbox id="suggestionBoxId" for="pftInput" rules="none" suggestionAction="#{bulkAdjustment.searchResource.autoComplete}"
       var="pft" fetchValue="#{pft.code}" minChars="1" width="200" height="150" cellpadding="2" shadowOpacity="4">
       <h:column>
       <h:outputText value="#{pft.code}" />
       </h:column>
       </richfaces:suggestionbox>
       </t:panelGroup>
       <a4j:commandButton value="Add" action="#{bulkAdjustment.updateProfitCenter}" styleClass="grey_12"
       reRender="divErrorMessage,divFields,divAdjTypes"/>
       <a4j:commandButton value="Find" reRender="divProfitCenter,divGroupButtons" type="button" styleClass="grey_12"
       action="#{bulkAdjustment.searchResource.showPftSearchResourcePanel}" oncomplete="javascript:Richfaces.showModalPanel('searchProfitCenter');"/>
       <t:message for="pftInput" styleClass="validationError"/>
      
       <t:outputLabel value="Profit Center Selected : " for="pftSelectedInput" styleClass="grey_11"/>
       <t:panelGroup colspan="3">
       <t:inputText id="pftSelectedInput" disabled="true" maxlength="20" value="#{bulkAdjustment.searchResource.searchResourcesBean.profitCenters}"
       styleClass="grey_11" style="width:217px"/>
       </t:panelGroup>
       <t:message for="pftSelectedInput" styleClass="validationError"/>
      
       <t:panelGroup colspan="4">
       <t:panelGrid columns="2" cellspacing="5" cellpadding="0">
       <t:commandButton value="Search" styleClass="grey_12" action=""/>
       <t:commandButton value="Clear" styleClass="grey_12" action="#{bulkAdjustment.clearFields}"/>
       </t:panelGrid>
       </t:panelGroup>
       </t:panelGrid>
       </t:div>
      
       <t:div id="divErrorMessage" styleClass="divAlignCenter" style="margin-top: 20px;">
       <t:messages id="errorMessage" layout="table" styleClass="ValidateError" globalOnly="true"/>
       </t:div>
      
       <%@include file="include/loading.jsp"%>
       </h:form>


      myBean

      public class AdjustmentType {
      
       private String name;
       private String code;
      
       public AdjustmentType(){}
      
       public AdjustmentType(String name,String code){
       this.name = name;
       this.code = code;
       }
      
       public int hashCode() {
      
       int result = 1;
       result += ((name == null) ? 0 : name.hashCode());
       result *= ((code == null) ? 1 : code.hashCode());
       return result;
       }
      
       public boolean equals(Object obj) {
      
       if (this == obj)
       return true;
      
       if (obj == null)
       return false;
      
       if (getClass() != obj.getClass())
       return false;
      
       AdjustmentType other = (AdjustmentType) obj;
       if (name == null) {
       if (other.name != null)
       return false;
       } else if (!name.equals(other.name))
       return false;
       if (!code.equals(other.code))
       return false;
       return true;
       }
      
       /**
       * @return the name
       */
       public String getName() {
       return name;
       }
       /**
       * @param name the name to set
       */
       public void setName(String name) {
       this.name = name;
       }
       /**
       * @return the code
       */
       public String getCode() {
       return code;
       }
       /**
       * @param code the code to set
       */
       public void setCode(String code) {
       this.code = code;
       }
      }