<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="java.sql.*,java.util.Date"%> <%@page import="java.util.List"%> <%@page import="java.util.Arrays"%> <%@page import="java.util.ArrayList"%> <%@page import="java.sql.ResultSet"%> <%@page import="java.sql.PreparedStatement"%> <%@page import="java.sql.Connection"%> <%@page import="java.sql.DriverManager"%> <%@include file="common.jsp" %> ALUMNI DIRECTORY | VGEC ALUMNI ASSOCIATION <% Connection con = null; try { Class.forName(application.getInitParameter("driver")); con = DriverManager.getConnection(application.getInitParameter("url"), application.getInitParameter("user"), application.getInitParameter("password")); /* Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost:3306/alumni", "root", "");*/ } catch (Exception e) { System.out.println(e); } String sql = null; List arrYog = new ArrayList(); List branchList = new ArrayList(); List cityList = new ArrayList(); if (request.getParameter("yog") != null) arrYog = Arrays.asList(request.getParameterValues("yog")); if (request.getParameter("branch") != null) branchList = Arrays.asList(request.getParameterValues("branch")); if (request.getParameter("city") != null) cityList = Arrays.asList(request.getParameterValues("city")); String yog =""; String branch = ""; String city = ""; for (String temp : arrYog) { if (temp.equals(arrYog.get(0))) yog += "'" + temp + "'"; else yog += ",'" + temp + "'"; } for (String temp : branchList) { if (temp.equals(branchList.get(0))) branch += "'" + temp + "'"; else branch += ",'" + temp + "'"; } for (String temp : cityList) { if (temp.equals(cityList.get(0))) city += "'" + temp + "'"; else city += ",'" + temp + "'"; } String search = request.getParameter("search"); String searchFor = request.getParameter("searchFor"); sql = "Select * from vaa_prof where registered=1 order by passingYear desc"; if (search != null) sql += " && firstName like '%" + search + "%'"; // or lastName='" + search + "' or emailID='" + search + "'"; if (searchFor != null) sql += " && account='" + searchFor + "'"; if(!yog.equals("")) sql += " && passingYear in ("+yog+") "; if(!branch.equals("")) sql += " && branch in ("+branch+") "; if(!city.equals("")) sql += " && city in ("+city+")"; System.out.println(yog + "\n "+ branch+"\n"+sql); Statement cs = con.createStatement(); ResultSet rs = cs.executeQuery(sql); %>

ALUMNI DIRECTORY


2015
2016
2017
2018
2019
2020

CE
EE
MECH
CHEM
CIVIL
EC
IC
IT

Ahmedabad
Rajkot
Gandhinagar
<% while (rs.next()) { %> <% if(rs.getString("enrollNo") != null){ %> <% }else{ %> <%}%> <% } con.close(); %>
Full Name Branch Passing Year Enrollment No.
<% if(rs.getString("pic") != null){ %> "> <%}%> <%=rs.getString("firstName") + " " + rs.getString("lastName")%> <%=rs.getString("branch")%> <%=rs.getString("passingYear")%><%=rs.getString("enrollNo")%>Not defined