<%-- Document : airline Created on : May 2, 2013, 12:17:24 PM Author : exam49 --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> <%@page import="java.sql.*" %> </head> <body> <% String txt = request.getParameter("id"); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=Z:\\myDB.mdb;"; Connection conn = DriverManager.getConnection(database, "", ""); PreparedStatement s = conn.prepareStatement("select * from airline where id='"+txt+"' "); ResultSet rs=s.executeQuery(); while (rs.next()) { out.println("<h4>"); out.println("name: "+rs.getString("id")); out.println("<br><br>destination "+rs.getString("dest")); out.println("<br><br>fare: "+rs.getString("fare")); out.println("<br><br>seats: "+rs.getString("seats")); out.println("</h4>"); } rs.close(); s.close(); conn.close(); } catch (Exception e) { out.print(e.getCause()); out.print(e.getLocalizedMessage()); out.print(e.getStackTrace()); } %> </body> </html>