At 04:08 PM 6/17/2002 -0400, you wrote: >Hi, > >I have a question regarding how to design a way that serves a text file to >the user via web pages, ie: a csv file. > >Would you > >1. create a DAO that writes to a text file, and somehow get the Servlet to >serve the file? >2. create an Action class with: > >response.setHeader("Content-Disposition","attachment;filename=data.csv"); > response.setHeader("Content-Type", "application/ms-excel"); > and have the following JSP write the actual contents. This way, the >JSP can use JSPTags, but the formatting is off. >3. Any other way.
I prefer create an Action class with: response.setHeader("Content-Disposition","inline;filename=myfile.xls"); response.setContentType("application/vnd.ms-excel"); Then write out standard html tables. Excel will format them. Formatting support varies between versions starting at: Excel 97 - basic table layout, no real coloring. to Excel XP - Even CSS formatting support for fonts and colors. But even in Excel 97. I still find it a lot more workable than straight csv. If you need to support Excel 95, you'll need to use csv instead. There's an example of this in Expresso called ExcelViewHandler: com.jcorporate.expresso.core.servlet.viewhandler.ExcelViewHandler HTH! -Mike -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>