Iam trying to show some results from database - multi results - on JSP page using struts, already did the servlet code to fetch the data as follow :
private void manage(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException{
ArrayList cats = new ArrayList();
PrintWriter out = response.getWriter();
try{
db.rs = db.statement.executeQuery("select * from cats");
while(db.rs.next()){
out.println("z");
cat cat = new cat();
cat.setCatname(db.rs.getString("catname"));
cat.setCatid(db.rs.getInt("catid"));
cats.add(cat);
}
request.setAttribute("cats", cats);
RequestDispatcher rr = request.getRequestDispatcher("./manage_cat.jsp");
rr.include(request, response);
}catch(Exception ex){
out.println(ex.getMessage());
}
}
cat.java
package lib;
public class cat {
private String catname;
private int catid;
public int getCatid() {
return catid;
}
public void setCatid(int catid) {
this.catid = catid;
}
public String getCatname() {
return catname;
}
public void setCatname(String catname) {
this.catname = catname;
}
}
manage_cat.jsp
<logic:present name="cats">
<logic:notEmpty name="cats">
<logic:iterate id="cc" name="cats">
<bean:write name="cc" property="catid" filter="true"/>
<br/>
</logic:iterate>
</logic:notEmpty>
</logic:present>
Blank Page !
no output at all :D
I tried to print variable ${cats} and it seems it already have objects = records in db ..
So, i dun know i think manag_cat.jsp has something wrong or maybe i should do or configure xml files ?
iam not sure .. any help apreciated