6 Replies Latest reply on Jun 26, 2009 5:20 AM by shivaji.byrapaneni

    rich:ListShuttle issue (has invalid value expression)

      Hi

      i have used rich:Listshuttle for my project and i tried with all impementations correctly but im still getting this error

      "Component nominationSystemHome:approveLS has invalid value expression com.vo.ApproveVO@262d5750"
      


      please note im using richafaces 3.3.1 GA version of richfaces

      and my code is like this

      JSP
       <rich:listShuttle binding="#{approveCoursesBean.approveLS}"
       sourceValue="#{approveCoursesBean.nominatedList}"
       targetValue="#{approveCoursesBean.approvedList}" var="people"
       sourceCaptionLabel="Nominated people"
       targetCaptionLabel="Approved people" id="approveLS"
       converter="approveCoursesConverter">
       <rich:column width="18">
       <h:graphicImage value="#{people.iconURI}" width="25px" height="25px" />
       </rich:column>
       <rich:column>
       <h:outputText value="#{people.userId}" />
       </rich:column>
       <rich:column>
       <h:outputText value="#{people.userName}" />
       </rich:column>
       </rich:listShuttle>
      


      converter im using is this

      package com.converter;
      
      import javax.faces.component.UIComponent;
      import javax.faces.context.FacesContext;
      import javax.faces.convert.Converter;
      
      import com.vo.ApproveVO;
      
      public class ApproveCoursesConverter implements Converter {
       @Override
       public Object getAsObject(FacesContext context, UIComponent component,
       String value) {
       String[] tokens = value.split(":");
       return new ApproveVO(tokens[0], Long.parseLong(tokens[1]), tokens[2],
       Long.parseLong(tokens[3]));
       }
      
       @Override
       public String getAsString(FacesContext context, UIComponent component,
       Object value) {
       ApproveVO approveVO = (ApproveVO) value;
       return approveVO.getIconURI() + ":" + approveVO.getUserId() + ":"
       + approveVO.getUserName() + ":" + approveVO.getCourseId();
       }
      
      }
      
      


      my VO is having this

      package com.vo;
      
      import java.io.Serializable;
      
      public class ApproveVO implements Serializable {
      
       private static final long serialVersionUID = 567670287797403100L;
       private String iconURI;
       private Long userId;
       private String userName;
       private Long courseId ;
      
       public long getCourseId() {
       return courseId;
       }
      
       public void setCourseId(long courseId) {
       this.courseId = courseId;
       }
      
       public ApproveVO(String iconURI, Long userId, String userName,Long courseId) {
       this.iconURI = iconURI;
       this.userId = userId;
       this.userName = userName;
       this.courseId = courseId;
       }
      
       public String getIconURI() {
       return iconURI;
       }
      
       public void setIconURI(String iconURI) {
       this.iconURI = iconURI;
       }
      
       public Long getUserId() {
       return userId;
       }
      
       public void setUserId(Long userId) {
       this.userId = userId;
       }
      
       public String getUserName() {
       return userName;
       }
      
       public void setUserName(String userName) {
       this.userName = userName;
       }
      
       @Override
       public boolean equals(Object obj) {
       if (this == obj)
       return true;
       if ((obj == null) || (obj.getClass() != this.getClass()))
       return false;
       ApproveVO approveVO = (ApproveVO) obj;
       if (approveVO.iconURI.equals(this.iconURI)
       && approveVO.userName.equals(this.userName)
       && approveVO.userId == this.userId && approveVO.courseId == this.courseId)
       return true;
      
       return false;
       }
      
       @Override
       public int hashCode() {
       int hash = super.hashCode();
       hash = 7 * hash;
       hash = 9 * hash
       + (null == this.userName ? 0 : this.userName.hashCode());
       hash = 11 * hash + (null == this.userId ? 0 : this.userId.hashCode());
       hash = 31 * hash + (null == this.courseId ? 0 : this.courseId.hashCode());
       return hash;
       }
      
      }
      
      


      my backing bean is this

      package com.managedbeans;
      
      import java.util.ArrayList;
      
      import javax.ejb.EJB;
      import javax.faces.event.ActionEvent;
      import javax.faces.model.SelectItem;
      
      import org.richfaces.component.html.HtmlListShuttle;
      
      import com.constants.NominationConstants;
      import com.entities.CourseDetailsEO;
      import com.entities.UserDetailsEO;
      import com.logger.NominationLogger;
      import com.services.local.CoursesInformationServiceLocal;
      import com.services.local.NominationInformationServiceLocal;
      import com.util.NominationUtil;
      import com.vo.ApproveVO;
      
      public class ApproveCoursesBean extends NominationBaseBean {
       private final String className = this.getClass().toString();
       @EJB(mappedName = NominationConstants.COURSEINFOSERVICE_LOCAL)
       private CoursesInformationServiceLocal coursesInformationService;
       @EJB(mappedName = NominationConstants.NOMINATIONINFOSERVICE_LOCAL)
       private NominationInformationServiceLocal nominationInformationService;
       private String courseName;
       private ArrayList<ApproveVO> nominatedList = new ArrayList<ApproveVO>();
       private ArrayList<ApproveVO> approvedList = new ArrayList<ApproveVO>();
       private HtmlListShuttle approveLS = new HtmlListShuttle();
      
       public HtmlListShuttle getApproveLS() {
       return approveLS;
       }
      
       public void setApproveLS(HtmlListShuttle approveLS) {
       this.approveLS = approveLS;
       }
      
       public ArrayList<ApproveVO> getNominatedList() {
       return nominatedList;
       }
      
       public void setNominatedList(ArrayList<ApproveVO> nominatedList) {
       this.nominatedList = nominatedList;
       }
      
       public String getCourseName() {
       return courseName;
       }
      
       public void setCourseName(String courseName) {
       this.courseName = courseName;
       }
      
       public ArrayList<ApproveVO> getApprovedList() {
       return approvedList;
       }
      
       public void setApprovedList(ArrayList<ApproveVO> approvedList) {
       this.approvedList = approvedList;
       }
      
       public String populateCourseListToApprove() {
       final String methodName = "populateCourseListToApprove";
       NominationLogger.logMethodEntry(className, methodName);
       ArrayList<CourseDetailsEO> courseList = getNominationSessionBean()
       .getCoursesList();
       getNominationSessionBean().setCourseNames(
       new SelectItem[courseList.size()]);
       CourseDetailsEO courseDetailsEO = null;
       for (int a = 0; a < courseList.size(); a++) {
       courseDetailsEO = courseList.get(a);
       getNominationSessionBean().getCourseNames()[a] = new SelectItem(
       courseDetailsEO.getCourseName());
       }
       NominationLogger.logMethodExit(className, methodName);
       return null;
       }
      
       public String populateNominationListBasedOnCourseSelected() {
       final String methodName = "populateNominationListBasedOnCourseSelected";
       NominationLogger.logMethodEntry(className, methodName);
       NominationLogger.info(this.courseName);
       ArrayList<UserDetailsEO> usersList = coursesInformationService
       .getNominatedUserForCourse(this.courseName);
       approveLS = new HtmlListShuttle();
       nominatedList = new ArrayList<ApproveVO>();
       approvedList = new ArrayList<ApproveVO>();
       ApproveVO approveVO = null;
       for (UserDetailsEO userDetailsEO : usersList) {
       approveVO = new ApproveVO(NominationConstants.NOMINATED_USER_ICON,
       userDetailsEO.getUserId(), userDetailsEO.getUserName(),
       userDetailsEO.getCourseId());
       nominatedList.add(approveVO);
       }
       NominationLogger.logMethodExit(className, methodName);
       return null;
       }
      
       public String confirmNomination(){
       final String methodName = "confirmNomination";
       NominationLogger.logMethodEntry(className, methodName);
       try{
       nominationInformationService.confirmNomination(approvedList);
       }catch(Exception e){
       e.printStackTrace();
       error(NominationUtil.getProperty(NominationConstants.UNEXPECTED_ERROR_MSG));
       }
       info(NominationUtil.getProperty(NominationConstants.NOMINATION_APPROVED_MSG));
       NominationLogger.logMethodExit(className, methodName);
       return null;
       }
      }
      
      


      i had faces similar problem earlier and solved that through correct implementaion of has code method and adding appropriate converter

      pleas help
      many thanks in advance...