This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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 Murach's Java Servlets and JSP this week in the Servlets 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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30068
    
149

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Swaroop Kunduru
Ranch Hand

Joined: May 22, 2006
Posts: 33
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
Marshal

Joined: Mar 22, 2005
Posts: 41062
    
  43
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?


Ping & DNS - my free Android networking tools app
 
jQuery in Action, 2nd edition
 
subject: How to open word and pdf document in the browser
 
Similar Threads
IFrame and word document
How to get open or save dialog in struts.
How to download a file without save/open dialogue box ?
Applet to print pdf files
pdf in new window