Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts2 file download from database

 
Rajani Panchumarthy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found the problem, the inputName I have specified is incorrect.I have changed to inputStream and it works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic