2009年7月31日 星期五

java ee servlet response

HttpServletResponse 物件是用來傳回結果到 browser,有些方法常用的方法:

設定 mime type:以下為 open office 的 odt 文件的 mime type
res.setContentType("application/vnd.oasis.opendocument.text");
設定編碼:
res.setCharacterEncoding("utf-8");
設定元件檔名:
res.addHeader("Content-Disposition", "attachment; filename=project-plan-book.odt");

沒有留言: