I am Tswana so please forgive me for my poor English. I am trying to
generate an ODT document from a servlet with no luck. I dont thing it
is an IO error but rather a TemplateException, a similar code work
without any issues form a stand alone application.
My code looks like this:
File directory =
(File)getServletContext().getAttribute(getServletContext().TEMPDIR;
directory..mkdir()
File outfile = File.createTempFile("samp2", "odt", directory);
try {
InputStream odtstream =
getServletContext().getResourceAsStream("/samp1.odt")
RhinoStreamTemplate template = new
RhinoStreamTemplate(odtstream);
template.setField("First Name", "Paballo");
template.saveAs(outfile); //save file in temporary directory
}
catch (Exception e) {
}
I look forward to your responses. Thank you in advance.