1

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.

lc.
  • 113,939
  • 20
  • 158
  • 187
user1216228
  • 383
  • 1
  • 4
  • 10
  • 1
    Welcome to SO. Please read the [faq] and [ask]. On SO we do not magically provide solutions to large problems like this. You are expected to do your own work and ask **specific** questions. – Jim Garrison Feb 20 '12 at 07:23
  • 1
    @user1216228:how you want to show the .doc file? you want to show it on jsp page or you want other way? Please specify – Umesh Awasthi Feb 20 '12 at 07:37
  • 1
    hello Umesh.I want to show that .doc file in a JSP page . please can you a give a good example code for the same. – user1216228 Feb 20 '12 at 08:42

1 Answers1

1

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.

Community
  • 1
  • 1
batbaatar
  • 5,448
  • 2
  • 20
  • 26