Brilliant! Thanks David.
I have implemented that with my database & DSN with this in the index.htt:
<%!
class Lot {
String photoPath;
String productDescription;
String buyItNowPrice;
String lotID;
public Lot(String photoPath, String productDescription, String buyItNowPrice, String lotID) {
this.photoPath = photoPath;
this.productDescription = productDescription;
this.buyItNowPrice = buyItNowPrice;
this.lotID = lotID;
}
}
%>
<%!
import java.sql.*;
Map lots = new HashMap();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:wellsdb");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("select PhotoPath, ProductDescription, BuyItNowPrice, LotID from Lot where BuyItNowPrice is not null and PhotoPath is not null");
while (rs.next()) {
String photoPath = rs.getString(1);
String productDescription = rs.getString(2);
String buyItNowPrice = rs.getString(3);
String lotID = rs.getString(4);
lots.put(photoPath, new Lot(photoPath, productDescription, buyItNowPrice, lotID));
System.out.println(photoPath + "\t" + productDescription + "\t" + buyItNowPrice + "\t" + lotID);
}
rs.close();
stmt.close();
con.close();
%>
This outputs the data correctly in the system console:
displayProductImage1.jpg Distressed Teak Coffee Table 456.0000 14
chinesebench.jpg Aqua sofa 87889.0000 1135
LINOCHBK.jpg 2 crystal vases (one chipped) 467.9000 1752
This is my slide.htt code:
<%!
Lot lot = (Lot)lots.get(photoPath);
%>
<ja:if exists="lot">
The filename is <%= lot.photoPath %>.
The description is <%= lot.productDescription %>.
The price is <%= lot.buyItNowPrice %>.
The HTML is <%= lot.payPalHTML %>.
</ja:if>
I get this error when I MAKE ALBUM:
Evaluation error on line 2:
Details:
Sourced file: inline evaluation of: `` Lot lot = (Lot)lots.get(photoPath); ;'' : Typed variable declaration : Undefined argument: photoPath
I can't work out why the slide.htt doesn't know about photoPath?
Thanks