didnt you by accident declare preparestatement twice? here: <%! int id; Connection conn=null; PreparedStatement pstm=null; ResultSet rs=null; %> and here: PreparedStatement pstm=conn.PrepareStatement("Select * from directory where id =?");
just write in the second time: pstm=conn.prepareStatment etc..... (drop the PreparedStatement declration again) im not sure if it is the problem , but i hope it helps somehow.