Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.mycompany.CRMFly.Converters; import com.mycompany.CRMFly.ManagedBeans.ProjectBean; import java.io.Serializable; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.convert.Converter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; /** * * @author ?? */ // @Component("participantInProjectConverter") @Scope("session") public class ParticipantInProjectConverter implements Converter, Serializable { @Autowired ProjectBean projectBean; @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { Long id = Long.parseLong(value.split(" ")[0]); return projectBean.getParticipantForId(id); } @Override public String getAsString(FacesContext context, UIComponent component, Object value) { return value.toString(); } }