aspose file tools*
The moose likes Struts and the fly likes Download link Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Download link" Watch "Download link" New topic
Author

Download link

kriegerd Salas
Greenhorn

Joined: Aug 01, 2005
Posts: 8
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

Joined: Feb 15, 2005
Posts: 4864
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.


Merrill
Consultant, Sima Solutions
kriegerd Salas
Greenhorn

Joined: Aug 01, 2005
Posts: 8
Thanx for the quick answer, I'll check it out.
kriegerd Salas
Greenhorn

Joined: Aug 01, 2005
Posts: 8
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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Download link