I don't know what is wrong with this codes that there is no error indication in the Netbeans Environment, yet the purpose for which they are coded is not being achieved. These codes are supposed to have display data form the database (View methods) all at once. The table name is:admin. And when the program is run, the table in which the data has to be displayed together with the submit button do not appear in the browser. The codes are divided into two: the one from the Session Bean and the other from the JSP page as shown below. I will be grateful if anybody has an idea of where the error is from.
1. Session Bean:
//className= viewAllAdmin
public ArrayList viewAllAdmin() {
ArrayList arr= null;
AdminLocal al= null;
//collection mthd inserted under AdminLocalHome
Collection col= null;
try{
col=alh.findByAll();
Iterator it= col.iterator();
while (it.hasNext())
al= (AdminLocal) it.next();
arr.add(new NewHelper (al.getAddressBureau(), al.getBureau(), al.getCity(),
al.getId(), al.getPassword(), al.getRank(), al.getRole() ));
}catch(Exception e){}
return new ArrayList ();
}
2. JSP page:
<%
NewSessionLocal nsl= null;
NewHelper nh=null; //helper class
%>
<%
//calling the servlet:
try {
Context c = new InitialContext();
NewSessionLocalHome rv = (NewSessionLocalHome) c.lookup("java:comp/env/NewSessionBean");
nsl= rv.create();
} catch (NamingException ne) {}
%>
<%
try{
if(request.getParameter("submit") != null ) {
ArrayList ll=nsl.viewAllAdmin();
if(!ll.isEmpty()){
Iterator it=ll.iterator();
while(it.hasNext()){
nh=(NewHelper) it.next();
%>
//table:admin
<tr>
<th width="8%" scope="col">id</th>
<th width="24%" scope="col">password</th>
<th width="18%" scope="col">role</th>
<th width="17%" scope="col">rank</th>
<th width="21%" scope="col">bureau</th>
<th width="6%" scope="col">address</th>
<th width="6%" scope="col">city</th>
</tr>
<tr>
<td><%=nh.getId()%></td>
<td><%=nh.getPassword()%></td>
<td><%= nh.getRole()%></td>
<td><%=nh.getRank()%></td>
<td><%= nh.getBureau()%></td>
<td><%=nh.getAddressB()%></td>
<td><%= nh.getCity()%></td>
</tr>
<tr>
<td>
<label>
<input type="submit" name="submit" id="submit" value="Submit">
</label></td>
</tr>
<%
}
}
}
}
catch(Exception e){}
%>