You only have to bind components that you're actually going to use as
addMessage targets.   In my experience, that happens infrequently
since most of the time the messages are generated by a validator or
converter.

And as I said, another approach is using findComponent instead of
explicitly binding.

If you hardcode the id in your java code, then you risk
synchronization errors if the id name changes in one place but not in
the other.

On 4/13/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
I tried looking into this approach of having a binding component in the
backing bean, but that seems *highly* onerous.  I would need a binding
component for nearly every input control.  I prefer using the forceId
approach.


----- Original Message -----
From: Mike Kienenberger <[EMAIL PROTECTED]>
Date: Friday, April 13, 2007 9:09 am
Subject: Re: forceId warning when using facelets
To: MyFaces Discussion <[EMAIL PROTECTED]>

> For addMessage, you need to provide
>
> component.getClientId(FacesContext.getCurrentInstance())
>
> You can either explicitly bind the component to your backing bean so
> you have a reference to it, or you can use a findComponent method.
>
>
> On 4/13/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > There are two reasons why I am using forceId, but both of them are
> > probably because I am not doing something correctly.
> >
> > 1) When I use an addMessage(id, ...) I have to specify the id of the
> > control for the message is intended.  It seems (maybe I am wrong)
> that> if I don't use forceId, the id used in JSF isn't the same as
> that> referred to in the addMessage().
> >
> > 2) I am using ajax4jsf and I was getting lots of duplicate id's.
> When I
> > used forceId, those errors disappeared.
> >
> > Maybe there are better ways to avoid these issues, but forceId
> worked> for me.
> >
>

Reply via email to