<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> TwiHotels : Hotel Directory <%@ include file="connectionDB.jsp" %> <%@ include file="header.jsp" %> <% ResultSet rs = null, rs1 = null; Statement st = null, st1 = null; String sql = ""; try { %>
  Home  
Hotel Directory
My Hotels »  |  Submit a Hotel »
<% sql = "select count(countryid) as ccid from country"; st = con.createStatement(); rs = st.executeQuery(sql); int total = 0; if(rs.next()){ total = rs.getInt("ccid"); } int pages = total/15; if(total%15 != 0) pages++; int pno = 1; if(request.getParameter("pno")!=null) pno = Integer.parseInt(request.getParameter("pno")); int start = 0; if(pno != 0){ start = (pno-1)*15+1; start --; } String pagination = ""; int i = 0; %> <%@ include file="pagination1.jsp" %> <% st = con.createStatement(); sql = "select * from country order by Rating desc limit "+start+", 15"; rs = st.executeQuery(sql); for(int ii = 0; ii < 5; ii++){ %> <% for(int j = 0; j < 3; j++){ if(rs.next()){ st1 = con.createStatement(); sql = "select * from city where countryid = '"+rs.getString("countryid")+"' order by Rating desc limit 0,10"; rs1 = st1.executeQuery(sql); String cityList = ""; while(rs1.next()){ cityList += ""+rs1.getString("cityname")+", "; } cityList += "... more"; %> <% } } %> <% } %>
<%=rs.getString("countryname")%>
<%=cityList%>
<%=pagination%>
<% } catch(Exception ex){ System.out.println("Error in hoteldir "+ex.getMessage()); } finally{ if(rs!=null) rs.close(); if(rs1!=null) rs1.close(); if(con!=null) con.close(); } %> <%@ include file="footer.jsp" %>