<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@page import = "java.util.*"%> <%@page import = "java.sql.*"%> <%-- The taglib directive below imports the JSTL library. If you uncomment it, you must also add the JSTL library to the project. The Add Library... action on Libraries node in Projects view can be used to add the JSTL 1.1 library. --%> <%-- <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> --%> LoginLogic <% String arr[] = new String[20]; //setting of type,source,destination in session String type = (String) session.getAttribute("type"); String source = (String)session.getAttribute("source"); String destination = (String) session.getAttribute("destination"); //connection for code try{ Class.forName("oracle.jdbc.driver.OracleDriver"); String url="jdbc:oracle:thin:@localhost:1521:xe"; out.println(type + source + destination); Connection con =DriverManager.getConnection(url,"system","test1234"); String query = "select code from booking where type=? and source=? and destination=?"; PreparedStatement ps = con.prepareStatement(query); ps.setString(1,type); ps.setString(2,source); ps.setString(3,destination); ResultSet rs = ps.executeQuery(); //connection for seats status if(rs.next()) { out.println("inside"); int code = rs.getInt("code"); out.println(code); query = "select seatno,status from seats where code=? order by seatno"; PreparedStatement ps1 = con.prepareStatement(query); ps1.setInt(1,code); ResultSet rs1 = ps1.executeQuery(); out.println("here"); while(rs1.next()) { out.println("inside rs1.next()"); int seatno = rs1.getInt("seatno"); String status = rs1.getString("status"); out.println(seatno+status); arr[seatno] = status; } session.setAttribute("cde",code); } con.close(); } catch(Exception e) { System.out.println(e + "LoginLogic"); } %>
<% int i=0;int j=0; for(i=0; i<5; i++){%> <%for(j=0; j<4; j++){%> <%}%> <%}%>
Seats availability