Dear Joe,
 
Thanks for your suggestion, if you don't mind can u send me the code itself.Becos i have a another task, which should be completed very soon.It's a personal request for every member of our community.Don't mind, if this hurts anybody feeling or status.
 
 
Thanks
 
Varna...
----- Original Message -----
From: Joe Cheng
Sent: Wednesday, December 12, 2001 9:53 PM
Subject: Re: Urgent !!!!!!!! Please help me

Ravindra,
 
Since you're using the <%! directive, you're just declaring methods, not actually calling them.  You need to actually call them.
 
You should also be aware that what you're doing is incredibly dangerous.  If two requests hit this page at the same time your output will be corrupt.  The best way is to put this Java code in a real class, but if you must do it in JSP do this--take out all the <%! declarations.
 
<%--
 * PrintFiles.jsp
 * Created on December 13, 2001, 4:00 PM
--%>
 
<%@ page import = "java.io.*" %>
<%@ page import = "java.sql.*" %>
<%@ page import = "javax.servlet.*" %>
 
<%--
 * @author Ravindra Varna
 * @version 1.0.0
--%>
<html>
 <body bgcolor = "#246890">
  <%
   Connection con;
   CallableStatement cstmt;
   ResultSet rs;
   String Hi = "Ravindra Varna";
   PrintWriter out;
    try
    {
     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     con = DriverManager.getConnection("jdbc:odbc:DB","sa","");
    }catch(Exception e)
    {
       out.println(e);
    }
 
    String mysql_Statement;
    String file_Name;
    try
    {
     mysql_Statement = "{call DB_Sl_FileName}";
     cstmt = con.prepareCall(mysql_Statement);
     rs = cstmt.executeQuery();
     
     while (rs.next())
     {
      file_Name = rs.getString(2);
      FileReader fr = new FileReader(file_Name);
      int c = 0;
      while (c != -1)
      {
       c = fr.read();
       out.println((char)c);
      }
     }
    }catch(Exception e)
    {
     out.println(e);
    }
  %>
 </body>
</html>
 

Reply via email to