This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Struts and the fly likes How to open word and pdf document in the browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to open word and pdf document in the browser" Watch "How to open word and pdf document in the browser" New topic
Author

How to open word and pdf document in the browser

Bonny Sen
Greenhorn

Joined: May 09, 2006
Posts: 26
Hello Friend,

Could any one please suggest a way of opening/viewing a word file or a pdf file in the browser. I am using JBoss 4 server and struts 1.2

The file can be opened in 2 ways:

1. Display the file name on the jsp page as a hyper link. On clicking the link the appropriate file should be opened for reading in the same browser.

2. There would be a radio button against the file name and a "View" submit button. Selecting the file by checking the radio button and clicking on the "View" button should open the file in the browser.

Please help.


With Love, Bonny
"Life is like an ice-cream, Enjoy it before it melts..."
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32635
    
215

Bonny,
While either approach is fine, I always prefer an approach that shows the user what type of file they will be getting upon clicking. In this case, it sounds like #2.

Note that whether it opens in the browser is dependent on the user's configuration. For example, I have .doc files set to prompt for download on my computer.


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Swaroop Kunduru
Ranch Hand

Joined: May 22, 2006
Posts: 37
Can someone Please help with a code snappet to open an MsWord using struts framework.

Thanks in advance.

Regards,

Swaroop Kunduru.


Regards,
Swaroop Kunduru
Ulf Dittmer
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
Struts is server-side library, while documents tend to be opened on the client; what are you trying to do - stream the document to the client?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to open word and pdf document in the browser
 
It's not a secret anymore!