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
--%>
* PrintFiles.jsp
* Created on December 13, 2001, 4:00 PM
--%>
<%@ page import = "java.io.*" %>
<%@ page import = "java.sql.*" %>
<%@ page import = "javax.servlet.*" %>
<%@ 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;
* @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)
{
{
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>
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>