my dog learned polymorphism*
The moose likes Struts and the fly likes struts2 file download from database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2 file download from database" Watch "struts2 file download from database" New topic
Author

struts2 file download from database

Rajani Panchumarthy
Greenhorn

Joined: Jan 27, 2009
Posts: 22
Hi,
Could you please help me with the configuration in struts2 for file download.
The following is the scenario that I have:
The database contains the filename, content type and binary stream of the file.

1. The JSP is populated with a list of filenames from database as hyperlink.
1.Click on a filename from JSP.Retrieve the filename in action class from JSP.
2. From the action class, the filename is sent as a parameter to the ejb layer that actually will retrieve the bytes of the corresponsding filename.
3. Show a dialog box to the user either to open the file or save the file in disk.

I have tried to use the following configuration in struts. xml file, but could not achieve the desired result.


Please give your ideas.

The content type that is the database can be of any type, image,pdf,excel,txt,etc

Thank you.
Rajani Panchumarthy
Greenhorn

Joined: Jan 27, 2009
Posts: 22
i found the problem, the inputName I have specified is incorrect.I have changed to inputStream and it works.
 
Don't get me started about those stupid light bulbs.
 
subject: struts2 file download from database
 
Similar Threads
struts2 result type stream problem
download file in struts2
Struts2 mapping query
Display Image using struts2
File download in struts2