The parameters gathered from the form are String objects. IO works the same in JSP, to write to a file you need to instantiate a FileWriter object. This can either be handled in the JSP file or in a bean that the JSP will use. This is one suggestion that will work. (you must import "java.io.*")
After that you can call form.print() or any other PrintWriter methods and it will write to your file. I don't understand your question about result sets. Also, even though you are using this on a JSP, your questions are really about I/O and JDBC respectively. You might get better answers in those forums.