Hello,
What id are you using exactly? To add a message to FacesContext you have to
use clientId, not the base id, so the message addition should be done this
way:
public String myAction()
{
FacesMessage message = new FacesMessage("My message");
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(myComponent.getClientId(context), message);
return null;
}
Regards,
~ Simon
On 3/17/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I have seemingly tried everything. I put forceId on the <t:inputText>
(which sets the id properly); I tried a validator and calling
addMessage() from within the validator method, which although it is
bulky it did work and the error message appeared; page-level validation
works (an error message appears if I leave the field empty). However,
it does not work if I call FacesContext.addMessage() from within the
action method. The error message does not show up. Is there something
else I have to do??? Like a PhaseListener or something? Some other
setting somewhere? I am absolutely sure I am getting the correct id
because I even used a binding property. I could really use some help.
This shouldn't be that difficult. Thanks!