Try something like this little servlet:
import java.io.IOException; import java.io.PrintWriter;
import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
public class CsvServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/csv");
PrintWriter out = response.getWriter();
out.write("Every,good,boy,does,fine\r\n");
out.write("face,in,the,space,dude\r\n");
out.flush();
}
}
klute wrote:
Hi All,
I am looking for some best practices advice on
handling this task:
I have a web application (written in Struts) that talks to some database. A browser user will be able user to export tabular data from the db in a comma delimited file and get a save as dialog box prompting to name the resulting file.
I have not done this before so i am looking for
suggestions on how to accomplish it (in terms of java
object interaction and whatever else).
Thanks a lot,
James
--- http://www.devbistro.com
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]