0

i copied these code from a website. but its not working please help me to solve error. image is not displaying

<%@page import="java.sql.ResultSet"%>
<%@ include file="getcon.jsp"%>
<html>
<head>
<title>View Image Page</title>
</head>
<body>
<table width="100%" border="0">
<%
ResultSet rs=null;
try
{
rs=st.executeQuery("select image from test");
while(rs.next())
{
 %>
<table width="70%" height="160" border="1" align="center">
<tr>
<td><img src="image/<%=rs.getString("image") %>" width="115" height="128" />    </td>
</tr>
</table>
<% 
}
}
catch(Exception e)
{
out.print(""+e.getMessage());
}
%>
 </table>
 </body>
 </html>

getcon.jsp contains database connection

<%@ page import="java.sql.*" %>
<%!Statement st=null;
Connection cn=null;
%>
<%
Class.forName("com.mysql.jdbc.Driver");
Connection     con=DriverManager.getConnection("jdbc:mysql://localhost/test","root","");


st=con.createStatement();
%>

so what changes should i make in this code. image is column name in test table.

  • Any error/exception? Does your image file exists? Do you think your design is correct i.e. SQL from within JSP? – SMA Jul 05 '15 at 13:26
  • no error/exception...table contains 5 files...table and image box is displaying on webpage...but image is not diplaying – Bipin Gawand Jul 05 '15 at 13:33

0 Answers0