myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexandre Jaquet <a.jaq...@avintis.com>
Subject FacesMessage displayed two times
Date Fri, 08 Sep 2006 08:34:32 GMT
Hi,

When I've some error, the error message is displayed two times with my 
code :

example :

 if (validateAction() == false)
    UtilGui.setJSFErrorMessage("action_null", new Exception());       

 public static void setJSFErrorMessage(String errorIdFromBundle, 
Exception fromEx) {
        if (errorIdFromBundle == null || 
errorIdFromBundle.trim().length() == 0) {
            ec.handleError("Invalid ERROR ID", ErrorLevel.FATAL);
        }
        FacesContext context = FacesContext.getCurrentInstance();
        ResourceBundle myRessourceBundle = 
ResourceBundle.getBundle("Errors", context.getViewRoot().getLocale());
        String myTranslatedString;
        try {
            myTranslatedString = 
myRessourceBundle.getString(errorIdFromBundle);
        } catch (MissingResourceException ex) {
            myTranslatedString = "[missing key '" + errorIdFromBundle + 
"' in properties file]";
        }
        context.addMessage(null, new FacesMessage(myTranslatedString));
        if (UtilGui.DEBUG_MODE && fromEx != null) {
            context.addMessage(null, new FacesMessage(fromEx.getMessage()));
            fromEx.printStackTrace();
        }
    }
any idea how to fix it ?

my best regards

Mime
View raw message