The open/save dialogue appears automatically if the file is of a type the browser does not understand.
To force an open/save dialogue, you must alter the HTTP response headers. I don't know how it's done in JSP, but in PHP it looks like this:
// Put in whatever MIME type or leave this one
header('Content-Disposition: attachment; filename=suggested_file_name.whatever');
// Grab and output the contents of the file.
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design