Validation ********** :: :: :: // get a reference to properties file to retreive messages FacesContext context = FacesContext.getCurrentInstance(); ResourceBundle bundle = ResourceBundle.getBundle("game.messages", context.getViewRoot().getLocale()); String msg = ""; // if number bigger, get appropriate message if ( userNumber.intValue() > randomNumber ) msg = bundle.getString("tryagain_smaller"); else // if number smaller, get appropriate message msg = bundle.getString("tryagain_bigger"); // add message to be displayed on the page via tag context.addMessage (null, new FacesMessage(msg));