Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sending an excel file from a servlet

 
Chris Stewart
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd like to offer up an excel file for users to download from a servlet. I feel like I've seen this done before, but I can't remember how it was done.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set the content-type and content-disposition headers.
Write either csv data or an html table to the page.
or
Use a 3rd party library such as POI.

There are several threads within the last couple weeks that go into greater detail on this. Do a search here and in the JSP forum on 'Excel' and you'll find plenty of posts.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
quoting from the forum page: My Profile | Register | Search | FAQ | Forum Home
 
Chris Stewart
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeroen Wenting:
quoting from the forum page: My Profile | Register | Search | FAQ | Forum Home


This example is exactly why people hate this place.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chris Stewart:
This example is exactly why people hate this place.


I'm drifting a bit from the topic here, but I think it's worth saying.
I've been signed up with this forum for less than a month. In that time, I've easily seen over a dozen people ask about sending, parsing, or otherwise working with Excel sheets in Servlets/JSPs -- many within days or hours of each other. I've personally answered this 3 or 4 times.

Seeing that Mr, Wenting has had 3600 posts and has been signed up since Oct of 2000. I think it's safe to say that he has probably seen that same question asked over a hundred times.

Experienced developers get tired of answering the same question over and over. The more experienced they are, the faster they will tire. Some will take the time to write a FAQ. Some, as Mr. Wenting has done will generously take the time to remind the asker that there is a way to search the list for the answer. Most, however, will just leave and not bother anymore.

Just about every list and forum I've ever seen has had a link to this essay:
http://www.catb.org/~esr/faqs/smart-questions.html#translations
including this one. And yet, the majority of questions on every list and forum are questions that have already been asked and answered many times.

If people who don't want to check to see if a question has been answered before asking it hate a given forum and leave, it doesn't hurt the forum. If someone who knows enough to answer the better questions leaves because they've burned out due to the endless repetition caused by the former type, then the forum/list suffers.

Sometimes RTFM, STFW, or GIYF are the best answers.
 
Chris Stewart
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where's the harm in just leaving the thread alone when you have nothing productive to say? Too many people enjoy being rude, esp here.

Ben got the point across the correct way.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've answered this question myself at least a dozen times in the last year alone.
At some point it gets extremely repetitive...

Maybe some people don't know there's a search function, in which case pointing it out helps them.

If they do know but are too lazy to use it, why help them at all?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've posted something at http://faq.javaranch.com/view?SearchFirst - feel free to link to it, or to add to it when you see fit.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some will take the time to write a FAQ....

Ilja Preuss, is a case in point... ;-)

Thank you.
[ January 15, 2005: Message edited by: Ben Souther ]
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ilja Preuss:
I've posted something at http://faq.javaranch.com/view?SearchFirst - feel free to link to it, or to add to it when you see fit.


hmm, java.lang.OutOfMemoryError trying to access the FAQ.
I know there's a lot to remember about Java, but is it really that much
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic