• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jsp attached to pdf file

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hope someone can help me on this.
My question is: Is it possible to attach a pdf file to a link on a jsp page?
I am reading from a database and have my data in a table on a jsp page. Then I want to be able to click on a publication number, then the actual publication should come up as a pdf file.
The code I have is for the java class:
public String execute2(int st, Writer out)
{
String et = "unknown";
try
{
String sql = "SELECT * FROM Publications WHERE PublicationTypeID = '" +st+"'";
Connection con = DriverManager.getConnection("jdbc dbc:AcessCore");
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sql);
while (rs.next())
{
//read data from database
String publicationNum=rs.getString(1);
String subject=rs.getString(2);
String authors=rs.getString(3);
String YearPublished=rs.getString(5);
out.write("<TR>");
out.write("<th>");
out.write("<a td href='Publication#.pdf'>"+publicationNum+"</td>");
out.write("<td>"+subject+"</td>");
out.write("<td>"+authors+"</td>");
out.write("<td>"+YearPublished+"</td>");
out.write( "</TR>" );
et = publicationNum;
}
rs.close();
s.close();
con.close();
}
catch (SQLException sqle)
{
sqle.printStackTrace();
}
catch(IOException eio)
{
}
return et;
}
THe link I am talking about is the one I just put in bold. This is just showing what I want. i have all my publications in a folder.
This is my second last problem. If anyone know how to do this, please help.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
out.write("<td> <a href='" + publicationNum + ".pdf'>"+publicationNum+"</a></td>");
I think that is what you are after
[ February 04, 2004: Message edited by: Eric Pascarello ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Eric pointed out, your problem is simply a matter of HTML notation. As such, I'm cattle-prodding this along to the HTML/Javascript forum.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic