<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %> Celebrity List for Movies <%@ include file="dbconn.jsp" %> <% try { String movie_name="",mo_nam="",moviename=""; mo_nam=request.getParameter("movie_name"); movie_name=mo_nam.replaceAll("and","&"); movie_name=movie_name.replaceAll("@@","and"); int id=0,count=0,i=0; //movie_name=request.getParameter("movie_name"); PreparedStatement ps=null,ps1=null; ResultSet rs=null,rs1=null; ps=conn.prepareStatement("select distinct movie_name,actress_name from movie_actress where movie_name=? order by actress_name "); ps.setString(1,movie_name); rs=ps.executeQuery(); while(rs.next()) { count++; } rs=ps.executeQuery(); String actress_name[]=new String[count+1]; String movie_list[]=new String[count+1]; int movie_count[]=new int[count+1]; while(rs.next()) { i++; actress_name[i]=rs.getString("actress_name");//out.print(actress_name[i]+"
"); //} movie_list[i]=rs.getString("movie_name"); ps1=conn.prepareStatement("select count(movie_name) from movie_actress where actress_name=? and movie_name=?"); ps1.setString(1,actress_name[i]); ps1.setString(2,movie_list[i]); rs1=ps1.executeQuery(); if(rs1.next()) { //out.print("bhuvanesh"); movie_count[i]=rs1.getInt(1);//out.print("
"+movie_count[i]); } } ps.close();rs.close();//ps1.close();rs1.close(); %> <%@ include file="0_a-z-header.jsp" %>
<% for(int k=1;k<=i;k++) { %> <%}%>
Celebrity Name Clips
  <%=actress_name[k]%>  <%=movie_count[k]%>

 

<% } catch(Exception e) { out.print(e); } %>