thank you sir for replying..
but i am storing images in a database.
i code this.. by this i only retrive one image what i gave inside the code.
but my question is when user put an id in front page. it will so three photoes related to that id.
will you please help me on this
<%
Connection connection = null;
String connectionURL = "jdbc:mysql://localhost:3306/mysql";
ResultSet rs = null;
PreparedStatement psmnt = null;
InputStream sImage;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "root", "root");
psmnt = connection.prepareStatement("SELECT picture FROM ricepicinfo WHERE ano = ?");
psmnt.setString(1, "n3");
rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
int size=0;
sImage = rs.getBinaryStream(1);
response.reset();
response.setContentType("image/jpeg");
while((size=sImage.read(bytearray))!= -1 ){
response.getOutputStream().write(bytearray,0,size);
}
}
}
catch(Exception ex){
out.println("error :"+ex);
}
finally {
// close all the connections.
rs.close();
psmnt.close();
connection.close();
}
%>