HELP! How to save resultset (NOT file) from server databse on local machine

Our JSP web system allows our clients to be able to search data from the server-side database and then after get the resultset, they also should be able to save these data as a text file on their local machine by just a click. Of course, before they click the OK button, they should navigate the files system on their local machines and choose under which directory they want to put the file, and then provide a file name. I could NOT find a way to be able to navigate the local machine's drives.

I know there is a standard Save As dialogue automatically launched by the browser. But my problem is: I don't need such a pumped-up Save As... dialogue which most brower will provide, because our system will have an interface which will provide the same function as the Save As guy. And this is the part that I am currently working on. Our interface will permit the client to browse their file system and then provide a filename, and then click OK to save the file. PLEASE, anybody who can help me. I know there are guys there have answers for my questions:

1. In my JSP program, I save the resultset I get from the database as a string, and then this string should be sent through inputstream and outputstream and be saved as a text file onto the client's local machine. I know there's a lot file download topics but I am dealing with a string instead of a file, is there an inputstream accepting a string(which contains dataresultset) and output it to a file?

2. As I already said, how to make my own Save As... dialogue?

I really need help! I have been bothered by them for a long time. Thanks in advance!

[1655 byte] By [huangjjing] at [2007-9-26 2:07:11]
# 1

How is the client going to receive this InputStream? Are they using applets? Why don't you just print the String to the client via a JSP expression tag? You could also write the String to a server based file and print the URL to the file to the client, so that he/she can navigate to the file and choose to save it.

rvflannery at 2007-6-29 8:54:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Well, it's hard to interpret exactly what you want to do but I'll take a stab.

I would put the data into comma separated value (CSV) format and then stream it back to the browser using the "application/csv" content format.

By doing this, they can either save it to their hard drive into the directory of their choice, or open it using whatever mapping they have for the CSV mime type. For most Windows machines, this is Excel (if it's loaded).

jpardi at 2007-6-29 8:54:12 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...