Senhores boa tarde.
Tenho tentado mas não consegui implementar a funcionalidade citada.
Eu criei um temple, consegui edit-alo e salva-lo.
Porem eu queria abrir o mesmo no navegador ou uma opção para baixar mas não estou conseguindo.
OBS: Não preciso nem salvar o arquivo na pc. Só precisaria que ele abrisse.
String id = request.getParameter("id");
Teste teste = new Teste ();
Teste DAO testedao = new TesteDAO();
teste= testedao.getById(Integer.parseInt(id));
String path = getServletContext().getRealPath("/tau/")
+ "/";
String rtfSource = "";
if(x) {
rtfSource = path + "a.rtf";
}else ify) {
rtfSource = path + "b.rtf";
}else if(g) {
rtfSource = path + "c.rtf";
}else if(h) {
rtfSource = path + "d.rtf";
}else ifu) {
rtfSource = path + "e.rtf";
}else if(w) {
rtfSource = path + "f.rtf";
}
RTFTemplateBuilder rtb = RTFTemplateBuilder.newRTFTemplateBuilder();
RTFTemplate rt = rtb.newRTFTemplate();
rt.setTemplate(new File(rtfSource));
rt.put("nome", teste.getNome());
rt.merge("/opt/tau/"+designacao.getPermissionario()+".rtf").getReader();
Salvo com sucesso. Como fazer para abrir no navegador?
Obrigado.