5 Replies Latest reply on Jul 31, 2009 4:24 PM by victor han

    Converter can not work when upgrade from 2.0 to 2.1

    victor han Newbie

      After I upgrade to seam2.1.2, my converters can not work now. Because I use injected objects in converter. It seems all injected objects will be null in 2.1's converter due to @BypassInterceptors).


      Here is my code:




      @Name("trialConverter")
      @BypassInterceptors
      @org.jboss.seam.annotations.faces.Converter(id="trialConverter")
      public class TrialConverter implements Converter, Serializable {
           private static final long serialVersionUID = 1L;
           @Logger
           private Log log;
      
           @In(required = false)
           private List<Trial> trialItems;
      
           public Object getAsObject(FacesContext arg0, UIComponent arg1, String value) {
                try {
                     for (Trial t : trialItems) {
                          if (t.getDscr().equals(value))
                               return t;
                     }
                } catch (Exception ex) {
                     return null;
                }
                return null;
           }
      
           public String getAsString(FacesContext arg0, UIComponent arg1, Object object) {
                String returnString = null;
                if (object instanceof Trial) {
                     Trial trial = (Trial) object;
                     returnString = trial.getId();
                     
                } 
                return returnString;
           }





      I'm wrong? or what should do to make it work?


      Thanks.