2
votes

Is it possible to call another JSF component from within a custom component (as opposed to from a composite one)?

In particular, I'm looking to call the PrimeFaces message component from within another component's encodeEnd method

I was (naively) hoping for something like this:

@Override
public void encodeEnd(FacesContext context, UIComponent component)
        throws java.io.IOException {

    // Do stuff...

    // set up Message object
    // tell Message object the current component's id
    // render Message object
}
1

1 Answers

3
votes

This should do:

import org.primefaces.component.message.Message;

// ...

Message message = new Message();
message.setParent(component);
message.setFor(component.getId());
message.encodeAll(context);