code: private void _saveMessages(FacesContext facesContext)
      {
          if (isKeepMessages()) 
          {
              // get all messages from the FacesContext and store
              // them on the renderMap
              List<MessageEntry> messageList = null;
                  
              Iterator<String> iterClientIds = facesContext.getClientIdsWithMessages();
              while (iterClientIds.hasNext())
              {
                  String clientId = (String) iterClientIds.next();
                  Iterator<FacesMessage> iterMessages = facesContext.getMessages(clientId);
                  
                  while (iterMessages.hasNext())
                  {
                      FacesMessage message = iterMessages.next();
      
                      if (messageList == null)
                      {
                          messageList = new ArrayList<MessageEntry>();
                      }
                      messageList.add(new MessageEntry(clientId, message));
                  }
              }
      
              _getRenderFlashMap(facesContext).put(FLASH_KEEP_MESSAGES_LIST, messageList);
          }
          else
          {
              // do not keep messages --> remove messagesList from renderMap
              _getRenderFlashMap(facesContext).remove(FLASH_KEEP_MESSAGES_LIST);
          }
      }
docs: Saves the current FacesMessages as a List on the render FlashMap for the
  next request if isKeepMessages() is true. Otherwise it removes any
  existing FacesMessages-List from the renderFlashMap.
  @param facesContext