OliviaRedhorse
asked on
How to open a document from a hyperlink on a JSP page?
I am attempting to create a hyperlink where the user can click to view a document, just as read only. It will be the same document as a reference. I have created my web application in a MVC design. I am using JSP as the GUI. Can anyone guide me with examples and/or suggestions on how to create this function? Thanks all.
ASKER
The hyperlink will open the same document.
Sorry - i don't understand - the same as what? All that is necessary is a valid url and the correct handler for that mime type to open the document ...
ASKER
When a user clicks on a hyperlink, the document will open. Forget "same". Sorry for the confusion.
one option is to create another jsp with read only texts and pass the values in the url when opening the page. example: readOnlyPage.jsp?field1=va lue1&field 2-value2.. .
btw, are you trying to display a print preview page?
btw, are you trying to display a print preview page?
ASKER
I have a document already written. This is not a print preview page. I just would like the user to be able to view this document.
>>When a user clicks on a hyperlink, the document will open.
See above. What kind of document is it?
See above. What kind of document is it?
ASKER
Sorry about that, it is a word document.
try <a href="../worddoc.doc" target="_blank">Open Doc</a>
>>Sorry about that, it is a word document.
As i mentioned earlier: just put a link to the document in
As i mentioned earlier: just put a link to the document in
ASKER
okay, I tried your idea and the first time I tried nothing happened. Then I copied the document in a new folder I called "files" and I get the HTTP 404 File not available error. I have changed the path several times and it still cannot find the file. What am I doing wrong? Thanks
Put the doc in the same folder as the jsp and refer to it as <a href="x.doc">Open it</a>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have tried both of your ideas and I continue to get the 404 message. This is the last thing I tried.
<a href="https://server:port/openDocTest/test.doc">User Manual</a>
<a href="https://server:port/openDocTest/test.doc">User Manual</a>
Check the path
ASKER
I do have real values in the server and the port section. The test.doc is in the same directory as the jsp pages.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I got it working. Thanks all.
:-)
thanks!
Documents would always be read only in these circumstances
>>It will be the same document as a reference.
Please explain the above