Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Download link  RSS feed

 
kriegerd Salas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I want to create a link to download a file. I'm using a servlet for this, but I wanted to know if there is a way to do it with struts.

Thanx a lot
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create an Action that will send data to the outputStream of the HttpServletResponse object. There is an example of this in the struts-examples.war file that comes with the V1.2 download. Check out the class org.apache.struts.webapp.exercise.ImageAction.
 
kriegerd Salas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx for the quick answer, I'll check it out.
 
kriegerd Salas
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.. I encountered this problem: java.lang.IllegalStateException: Response is already committed.


I used part of the code in the ImageAction example, and set the content type to "application/octet-stream". I want the browser to open the save dialog after clicking on the link, but struts has already used the response. So, how can I do this in struts?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!