codice:
<%@ page language="java" %>
<%@ page session="false" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<html>
<head>
<title>La palestra di JSP</title>
</head>
<body>
<%
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String URL = "/dba.mdb";
String strcon = "jdbc:odbcriver={Microsoft Access Driver (*.mdb)};DBQ="+URL;
Connection con = null;
con=DriverManager.getConnection(strcon, "", "");
String sql = "SELECT ragione_sociale, indirizzo FROM Clienti";
Statement stmt =con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
%>
Titolo della tabella
<table width="50%" border="10">
<tr>
<th>Ragione_sociale 1</th>
<th>Indirizzo 1</th>
</tr>
<%
while (rs.next()) {
String ragione_sociale = rs.getString(1);
String indirizzo = rs.getString(2);
%>
<tr>
<td><%=ragione_sociale%></td>
<td><%=indirizzo%></td>
</tr>
<%
}
rs.close();
rs=null;
stmt.close();
stmt=null;
}
catch(Exception e)
{
System.out.println("Error in creating the connection"+e);
}
%>
</table>
</body>
</html>
c'era un */ di troppo e rs.close lo puoi fare in vbscript ma in java devi fare rs.close();