user1216228
user1216228

Reputation: 393

How to download a doc file using struts 2.x

I have a requirement that I have to download a .doc file from database and show to the user.

So I am using struts 2.x and SQL server as my database.

So the user enters a password, the user can able to see his doc file which was fetched from the database.

Please can you provide me a sample example for the above requirement.

Upvotes: 1

Views: 936

Answers (1)

batbaatar
batbaatar

Reputation: 5468

If you're trying to show DOC file as html, please refer to this thread:

Convert Word doc to HTML programmatically in Java

Or if you're trying to generate DOC file from database, I would recommend Apache POI tool. The basic operation is, you should have your own DOC template file, and you can change and add values from JAVA file.

Also you can use reporting tools such as: JasperReport, Birt and XDocReport. But I am not sure about the last one. The things is, it is difficult to generate well-formed DOCs when using report tools.

Hope this helps.

Upvotes: 1

Related Questions