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.