1 Reply Latest reply on May 23, 2011 3:26 AM by Matthias

    Another converter problem with no enterpriese services

    Matthias  Newbie

      I'm wondering is it possible to use a converter for a arbitrary object without to use a enterprise container.

      This is my enviroment:
      - JBoss 4.2
      - JSF 1.2
      - Seam 2.2
      - RichFaces 3.4

      I have a Class as registred converter for MyClass and an ArrayList of MyClass in a

      <h:selectOneMenu> / <s:selectItems>


      When a item is selected the converter give me a correct MyClass-object back but I get the messages 'Value is not valid' if I choose another element the converter-object is not pass through.

      What did I missed? I'v seen some examples without enterprise container for

      <h:selectOneMenu> / <f:selectItems> and List<SelectItem>

      Has me someone a helping hand? Here is a codeexample of my:

      @Name(value = "myConverter")
      public class MyConverterimplements javax.faces.convert.Converter{
              public MyClass getAsObject(FacesContext context, UIComponent component, String value) {
                      LOGGER.debug("do my stuff to get the object");
                      return new MyClass();
              public String getAsString(FacesContext context, UIComponent component, Object object) {
                      try {
                              return ((MyClass)object).getLabel();
                      } catch (Exception e) {
                              LOGGER.debug("Error in .... -> "+e.getMessage());
                              return null;
      <h:selectOneMenu value="#{example.selectedMyClass}"
       <s:selectItems value="#{myListeOfMyClass}" var="object" label="#{object}"/>
        <f:converter converterId="myConverter" />