[jboss-user] [JBoss Seam] - Re: Seam FacesMessages with its createFacesMessage method an

fernando_jmt do-not-reply at jboss.com
Sat Feb 10 15:27:27 EST 2007


"petemuir" wrote : You can use: 
  | 
  | FacesMessages.instance().addFromResourceBundle(getClientId(facesContext), severity, key, params);


I tried what you suggest me before posting the message here. But it does not work.

This because the ValidatorException has this signature when creating it:

  | public ValidatorException(javax.faces.application.FacesMessage facesMessage)
  | 


So, I need a FacesMessage in order to use it for the ValidatorEception constructor.

This is was I tried:


  |  FacesMessages.instance().addFromResourceBundle(uiComponent.getId(), FacesMessage.SEVERITY_ERROR, MESSAGE_KEY, messageParams);
  |             
  |             throw new ValidatorException(new FacesMessage());
  | 

But adding above code does not work. It validates, but no message appear in the page. So, FacesMessages.instance().addFromResourceBundle() does not work in this situation.

I also tried this and this works:


  | FacesMessage message =FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR, "The value (#0) is not equal with value of #1", messageParams);
  | 
  | throw new ValidatorException(message);
  | 
  | 

But in the above code the problem is that there is no way to create a FacesMessage from resource bundle. This is the reason because I suggest to add the method I mentioned before.


Is there something I am missing?

There is another way?

Thanks in advance.



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

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



More information about the jboss-user mailing list