exportieren von Inhalt in eine text-Datei mit Hilfe von java mit der speichern-dialog

habe ich ein ResultSet, das hat einige Werte, die ich will, um die Daten zu exportieren, die es im Ergebnis als text-Datei mit der speichern-dialog.

wie man dies in java?.

Habe ich getan, die genannten Anforderungen für excel und java wie folgt aus.

response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition", "attachment; filename=\"" + reportName + ".xls\"");

und

response.setHeader("Content-disposition", "attachment; filename=\"" + reportName + ".pdf\"");
response.setContentType("application/pdf");

UPDATE :

if(exportTo.equals("text")){
            response.setContentType("text/plain");
            response.setHeader("Content-disposition", "attachment; filename=\"" + reportName + ".txt\"");
            try {

            } catch (Exception e) {
                //TODO: handle exception
            }

        }

in diesem

im try-block aus, wie der Inhalt, die lieferbare von resultset-zu einer output-stream und zur Verfügung stellen.

InformationsquelleAutor Java Questions | 2012-09-26

Schreibe einen Kommentar