Pessoal, meu JSP precisa criar um arquivo.csv no meu servidor: …/webapps/nome_aplicacao/temp/arquivo.csv
Com o cógigo abaixo eu consigo criar a pasta “temp”, mas o arquivo.csv eu nao consigo… o que está errado???
ServletContext ctx = getServletContext();
String path = ctx.getRealPath( "/" );
out.print("<br>PATH: " + path);
File diretorio = new File(path + "temp");
diretorio.mkdir();
String pathArquivo = path + "temp\\Relatorio.csv";
out.print("<br>PATH ARQUIVO: " + pathArquivo);
File arquivo = new File ( pathArquivo );
FileWriter fw = new FileWriter( pathArquivo );
PrintWriter saida = new PrintWriter( fw, true );
saida.print(conteudo);
saida.close();
fw.close();
