File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes open document using if statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

open document using if statement

orelia hans
Ranch Hand

Joined: Jan 29, 2004
Posts: 37
I tried to attach files to my database for me to be able to retrieve those documents on the web using an id number. I used binary objects but it didn't work.
Now I am using a method to read the id from the web then open the document. I think it can work but I don't know how.
On the jsp page I have :
out.write(""+publicationNum+"</td>");
Then on the other hand :
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc dbc:AcessCore");
publicationNumber = request.getParameter("id");
out.println(publicationNumber);

if(publicationNumber=="NNR1")
{
??? how do I open a specfic document when you click on the link?
}

else if(publicationNumber=="NRR1")
{
href="C://hello.doc"; doesn't work
}
rs.close();
s.close();
con.close();
}
catch (
ClassNotFoundException e1) { }
catch (SQLException e2) { }
I have like 100 publications and I have to do this one by one. Can someone tell me how to do that? opening the document as a new window.
Any help will be so much appreciated.
Thanks
[ February 16, 2004: Message edited by: Paul Wheaton ]
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Intersting. This post has nothing to do with Linux. I mean, you aren't even on a Linux machine. I know this because of the line
href="C://hello.doc"; doesn't work

Oh well, moving to JSP.


GenRocket - Experts at Building Test Data
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Actually, since this is a dupe of a question already asked in this forum, I'm closing this topic.
orelia, please do not cross-post the same question in multiple fourms.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: open document using if statement