I am getting this error now :
org.apache.jasper.JasperException: getOutputStream() has already been called for this response
I tried to catch the java.lang.IllegalStateException but it's then complains of catching it twice.
My code still same:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc

dbc:AcessCore");
String st = request.getParameter("id");
String sql = "SELECT Document FROM NEPRUPublications WHERE PublicationID = '" +st+"'";
Statement s= con.createStatement();
ResultSet rs=null ;
response.setContentType("application/pdf");
ServletOutputStream o= response.getOutputStream();
BufferedInputStream bis = new BufferedInputStream(rs.getBinaryStream("sql"));
byte bindata[] = new byte[2048];
int bytesread = 0;
while ( (bytesread = bis.read(bindata,0,bindata.length)) != -1 )
{
o.write(bindata);
o.close();}
rs.close();
s.close();
con.close();
}
catch (ClassNotFoundException e1) {
// JDBC driver class not found, print error message to the console
System.out.println(e1.toString());
System.out.println("oh lala!");
}
catch (SQLException e2) {
// Exception when executing java.sql related commands, print error message to the console
System.out.println(e2.toString());
System.out.println("try again");
}
catch (Exception e3) {
// other unexpected exception, print error message to the console
System.out.println(e3.toString());