<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> TwiHotels : Hotel Directory <%@ include file="connectionDB.jsp" %> <%@ include file="header.jsp" %> <% ResultSet rs = null; Statement st = null; String sql = ""; try { %>
  Home  
Submit Your Hotel »
<% sql = "select count(HotelId) as chid from hoteldir a, country b, city c where a.CountryId = b.countryid and a.CityId = c.cityid"; //out.print(sql); st = con.createStatement(); rs = st.executeQuery(sql); int total = 0; if(rs.next()){ total = rs.getInt("chid"); } 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 hoteldir a, country b, city c where a.CountryId = b.countryid and a.CityId = c.cityid order by HotelId desc limit "+start+", 15"; //out.print(sql); rs = st.executeQuery(sql); String desc = ""; while(rs.next()){ desc = rs.getString("Description"); if(desc.length() > 200){ desc = desc.substring(0,200)+" ..."; } %> <% } %>
"><%=rs.getString("HotelName")%>
<%=desc%>
<%=pagination%>
<% } catch(Exception ex){ System.out.println("Error in hotels "+ex.getMessage()); } finally{ if(rs!=null) rs.close(); if(con!=null) con.close(); } %> <%@ include file="footer.jsp" %>