public static void ecritureFichier (String cle,String message) throws IOException {
//Charge le contenu du fichier de properties dans un objet Properties
String propertiesFilePath = "/WEB-INF/classes/messages.properties";
File fichier = new File(propertiesFilePath);
//PROPERTIES.load(new FileInputStream(destinataire));
PROPERTIES.load(new FileInputStream(fichier));
//Change la valeur de la clé dans l'objet Properties
PROPERTIES.setProperty(cle,message) ;
//Charge le contenu de l'objet Properties dans le fichier properties
FileOutputStream oStream = new FileOutputStream(propertiesFilePath) ;
PROPERTIES.store(oStream,cle) ;
}
Partager