So, I think the MessageFactory class you have is not needed.  You can use Seam 
org.jboss.seam.core.FacesMessages class instead.

Below you can see an example I have:


  | 
  | @Name("converters")
  | public class Converters {
  | 
  |     @Transactional
  |     public Converter getRoleConverter() {
  |         return new Converter() {
  | 
  |             @Transactional
  |             public Object getAsObject(FacesContext facesContext, 
UIComponent uiComponent, String string) throws ConverterException {
  |                 Role role = ((EntityManager) 
Component.getInstance("entityManager")).find(Role.class, string);
  |                 if (role != null)
  |                     return role;
  |                 else {
  |                     FacesMessage message = 
FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR, 
"Common.error.selected_NotFound", null, "");
  |                     throw new ConverterException(message);
  |                 }
  |             }
  | 
  |             public String getAsString(FacesContext facesContext, 
UIComponent uiComponent, Object object) throws ConverterException {
  |                 return ((Role) object).getName();
  |             }
  |         };
  |     }
  | 
  | }
  | 
  | 

Common.error.selected_NotFound is a key in the messages.properties.


HTH.


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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037626
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to