[jboss-user] [JBoss Seam] - FacesMessages looses component ID for validation?

andrew.rw.robinson do-not-reply at jboss.com
Mon Jul 24 18:21:49 EDT 2006


Okay, I am observing some odd behavior. I have a backing bean with a custom validation method. In there I added a validation error message using the FacesMessages.add(String, FacesMessage) method. However, when I debug the faces context, the message is there, but the component ID is not. If I use the normal FacesContext to add the message it works.

Works:
public void validUniqueName(FacesContext context, 
  |     UIComponent toValidate, Object value)
  | {
  |   ...
  |   context.addMessage(toValidate.getClientId(context), 
  |     FacesUtils.createErrorMessage("liverep_uniquename", name));

Doesn't work:
public void validUniqueName(FacesContext context, 
  |     UIComponent toValidate, Object value)
  | {
  |   ...
  |   facesMessages.add(toValidate.getClientId(context), 
  |     FacesUtils.createErrorMessage("liverep_uniquename", name));

When it works, my debugging code prints:
16:14:05,231 DEBUG [DebugPhaseListener] Faces message found.
  |   Component: lreActionPane:name
  |   Severity : Error
  |   Summary  : A template already exists with the name 'Test report'
  |   Detail   : A template already exists with the name 'Test report'

When I use facesMessages:
16:14:05,231 DEBUG [DebugPhaseListener] Faces message found.
  |   Component: null
  |   Severity : Error
  |   Summary  : A template already exists with the name 'Test report'
  |   Detail   : A template already exists with the name 'Test report'

What am I missing? Why is the client ID not included?

Thanks,
Andrew

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3960536#3960536

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3960536



More information about the jboss-user mailing list