Announcement Announcement Module
Collapse
No announcement yet.
JSF Problem with enums Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JSF Problem with enums

    Hi I'm having a problem using enums in jsf add-on, this is my enum:

    public enum DocumentacaoPropriedade {

    NAOEXISTE("Nao existe"), EXISTE("Existe");

    private final String displayName;

    DocumentacaoPropriedade(String displayName) {
    this.displayName = displayName;
    }

    public String toString() {
    return this.displayName;
    }

    }


    This is the componente using this enum:

    AutoComplete documentacaoPropriedadeCreateInput = (AutoComplete) application.createComponent(AutoComplete.COMPONENT _TYPE);
    documentacaoPropriedadeCreateInput.setId("document acaoPropriedadeCreateInput");
    documentacaoPropriedadeCreateInput.setValueExpress ion("value", expressionFactory.createValueExpression(elContext, "#{blocoIBean.blocoI.documentacaoPropriedade}" , DocumentacaoPropriedade.class));
    documentacaoPropriedadeCreateInput.setCompleteMeth od(expressionFactory.createMethodExpression(elCont ext, "#{blocoIBean.completeDocumentacaoPropriedade} ", List.class, new Class[]{String.class}));
    documentacaoPropriedadeCreateInput.setDropdown(tru e);
    documentacaoPropriedadeCreateInput.setRequired(fal se);
    documentacaoPropriedadeCreateInput.setConverter(ne w EnumConverter(DocumentacaoPropriedade.class));
    htmlPanelGridInner.getChildren().add(documentacaoP ropriedadeCreateInput);

    But everytime I try to submit my form I get a message: 'Nao existe' must be convertible to enum

    I already set the converter, but I don't know what I'm doing wrong.

    Could someone help me?

    Thanks in advance!
Working...
X