السلام عليكم
احاول اكتب كود يعرض الصور الموجوده في الفولدر ,,, بس للاسف ولا صورة تتطلع .. و مب عارفه وين الغلط ..
هذا الكود كامل :
<HTML>
<HEAD><TITLE>Handbags</TITLE></HEAD>
<BODY>
<%@ page import="java.sql.*" %>
<TABLE BORDER=1 width="75%">
<%
Connection conn = null;
Statement st = null;
ResultSet rs = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection("jdbc:mysql://localhost/fashion?user=root&password=root");
st = conn.createStatement();
rs = st.executeQuery("select Pro_ID from products where Cat_No=1");
while (rs.next()) {
%>
<TR><TD><%= rs.getString("Pro_ID")%>
<%
String[] names = {"Pro_ID"};
for (int i = 0; i < names.length; i++) {
%>
<img src="images/<%=names%>.jpg" width="255" height="192" alt="<%=names%>"/>
</TD>
</TR>
<%
}
}
%>
</TABLE>
<%
} catch (Exception ex) {
ex.printStackTrace();
%>
Ooops, something bad happened:
<%
} finally {
if (rs != null) {
rs.close();
}
if (st != null) {
st.close();
}
if (conn != null) {
conn.close();
}
}
%>
</BODY>
</HTML>ممكن حد يخبرني شو اعدل في هالكود :
String[] names = {"Pro_ID"};
for (int i = 0; i < names.length; i++) {
%>
<img src="images/<%=names%>.jpg" width="255" height="192" alt="<%=names%>"/>لاني ابا الكود يعرض كل الصور الموجوده في الفولدر حسب الquery