Question

Here's my FacesComponent class:

@FacesComponent("ExibicaoChecklistComponent")
public class ExibicaoChecklistComponent extends UINamingContainer {

    private ListaChecklistWrapper checklist;
    private String altura;

    public ListaChecklistWrapper getChecklist() {
        return checklist;
    }

    public void setChecklist(ListaChecklistWrapper checklist) {
        this.checklist = checklist;
    }

    public String getAltura() {
        return altura;
    }

    public void setAltura(String altura) {
        this.altura = altura;
    }
}

and the xhtml

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:cc="http://java.sun.com/jsf/composite"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:pretty="http://ocpsoft.com/prettyfaces"
  xmlns:ui="http://java.sun.com/jsf/facelets">
<cc:interface componentType="ExibicaoChecklistComponent">
    <cc:attribute name="altura" default="300px" type="java.lang.String" />
    <cc:attribute name="checklist" required="true" />
</cc:interface>
<cc:implementation>
    Altura: #{cc.altura}
    Checklist: #{cc.checklist.nome}
</cc:implementation>

and finally the usage:

<checando:exibicaoChecklist altura="200px" checklist="#{CheckBean.checklists[0]}"  />

The setAltura method is called with the 200px value, but the setChecklist(ListaChecklistWrapper checklist) is not called and the checklist attribute is always null inside the component.

If I do #{CheckBean.checklists[0].nome} outside the <checando:exibi... tag it works. So, the object is not null... it's only a missing call to the set method.

Is there anything I'm missing?

Mojarra 2.1.13 (20120907-1514) and java version "1.7.0_25".

Thanks.

Was it helpful?

Solution

I guess, giving the nome directly as a parameter into the component does work again? (Something like setChecklistNome(String nome).

If so, there might be a challenge with giving direct parameters different from java.lang.String. Have you tried to give the parameters as cc.attrs.checklist instead from writing it directly into the UINamingContainer?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top