Hey Ravindra,
One suggestion i would like to give you ..is that ur .jsp file looks more like a .java file. Eliminate all your java code and database connections, statements and put them in a .java file. That will make ur job easy later on...Access database thru a java bean from a JSP. U should put the java code in a java file and then compile the java file and call the methods in the java file. 
Instead of  file://out.println(e); use
System.out.println(" Exception: +e");
 
Hope it helps.
Praveen
----- Original Message -----
From: Chen, Gin
Sent: Wednesday, December 12, 2001 8:36 AM
Subject: Re: Urgent !!!!!!!! Please help me

If this is the page in question then the problem is that you are not calling any of the methods. Also, you might want to make sure that the jsp page actually compiles. I dont know what  file://out.println(e); is but I'm sure it wont compile.
-Tim
-----Original Message-----
From: Ravindra [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 12, 2001 6:40 AM
To: [EMAIL PROTECTED]
Subject: Urgent !!!!!!!! Please help me

Dear All,
 
    Problem :
                    I have a jsp page, which should talk to database and fetches file name from the table and prints the file on to browser.
 
    Current Result :
                    No error, but there is no single data from the file are not written to the browser.
 
    Request :
                    Can any body send me the code for my requirement, earliest.
 
Code :
 
<%--
 * 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;
  %>
  <%!
   void getConnection()
   {
    try
    {
     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
     con = DriverManager.getConnection("jdbc:odbc:DB","sa","");
    }catch(Exception e)
    {
     
file://out.println(e);
    }
   }
  %>
  <%=Hi %>
  <%!
   void getResultSet()
   {
    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);
    }
   }
  %>
  <%=Hi %>
 </body>
</html>
 
 
 
 
Thanks
 
Varna.

Reply via email to