If a user dictionary is located in a WAR, it can be read, using the code below. Note though, that the 'add' button will not work, as the dictionary cannot be written to.
//construct an instance of the core RapidSpell spell checker String licenseKey = "zz"; com.keyoti.rapidSpell.RapidSpellChecker rapidSpellChecker = new com.keyoti.rapidSpell.RapidSpellChecker(licenseKey);
// File name of user dictionary inside WAR. java.lang.String userFileName = "spellcheck/rapidspell-user.txt"; // get real path to operating system file. String realpath = config.getServletContext().getRealPath(userFileName); // instantiate a java File object to the real path. java.io.File userFile = new java.io.File( realpath );
//set the dict file steam to the file. rapidSpellChecker.setUserDictionary(userFile);
<RapidSpellWeb:rapidSpellWeb checkerEngine="<%=rapidSpellChecker %>" SSLFriendly="true" licenseKey="zz"/>
|