6 Replies Latest reply on Apr 19, 2007 3:16 PM by sammy8306

    @Converter usage in ui example problem

      I am trying to get the following code to work that was taken almost verbatim from the ui example in Seam 1.2.1. By the converter is never called.

      In fact is does not work for me in the ui example either. I put a System.out and recompiled the example and I never see any output.

      Any help would be most appreciated.

      
      import static org.jboss.seam.InterceptionType.NEVER;
      
      import javax.faces.component.UIComponent;
      import javax.faces.context.FacesContext;
      import javax.faces.convert.ConverterException;
      
      import org.jboss.seam.annotations.Intercept;
      import org.jboss.seam.annotations.Name;
      
      
      @Name("newlineConverter")
      @Intercept(NEVER)
      @org.jboss.seam.annotations.jsf.Converter
      public class NewlineBrConverter implements javax.faces.convert.Converter
      
      {
       public NewlineBrConverter() { }
      
       public String getAsString(FacesContext context, UIComponent component, Object value)
       {
       try {
       System.out.print("newlineConverter");
       return ((String)value).replaceAll("\r\n","<br/>");
       } catch (Exception e) {
       return null;
       }
       }
      
       public Object getAsObject(FacesContext context, UIComponent component, String value) throws ConverterException
       {
       System.out.print("newlineConverter");
       return value + "";
       }
      
      }
      


       <rich:column styleClass="wrap" >
       <f:facet name="header">text</f:facet>
       <h:outputText value="#{messageL.text}" converter="#{converters.newlineConverter}"/>
       </rich:column>