Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
クエリした結果をExcelまたはcsvにエクスポートしたいと思います。普段は表示タグの関数を使ってcsvにエクスポートしていますが、今回は…レコードが2万枚を超えるので、結果を表示せず、Excelファイルを提供するだけで問題です。
JavaExcelAPIをご覧ください。もう1つのオプションはApachePOIです。
サーブレットを使用し、CSV(またはExcel)形式でデータを応答出力ストリームに書き込み、応答に適切なコンテンツタイプを設定し、次のヘッダーを設定してください。
response.setHeader("Content-disposition", "attachment; filename=someFile.csv");
JavaからCSVまたはExcelを生成するためのライブラリはたくさんあります。