JaumeG wrote:
Hi Ed !

Thank you for your reply,

I got a NULL when using the MAP Solution, perhaps I'm forgetting something
?. I have been debugging the code and in fact the Map is created and inserted
in the ArrayList.
I think it must be something you're forgetting. I got this to work:

<%@ taglib uri="http://displaytag.sf.net"; prefix="display" %>
<%@ page import="java.sql.*"%>
<%@ page import="java.util.*"%>
<html>
   <head>
   </head>
   <body>
<% int i = 0;
   Connection con = null;
   Statement stmt = null;
   ResultSet rs = null;
   try {
       Class.forName("org.postgresql.Driver");
con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/test", "postgres", "secret");
       stmt = con.createStatement();
stmt.setMaxRows(20000); // limited to 20000 rs = stmt.executeQuery("select * from testtable");
       ResultSetMetaData rsmd = rs.getMetaData();
       int cols = rsmd.getColumnCount();
ArrayList ar = new ArrayList(); int j = 0;
       while (rs.next()) {
          Map elementos = new HashMap();
          for (j = 1; j <= cols; j++)  {
              elementos.put(rsmd.getColumnName(j), rs.getString(j));
} ar.add(elementos); }

request.setAttribute("array",ar); } catch (Exception e) {
       e.printStackTrace();
   } finally {
         rs.close();
         stmt.close();
         con.close();
   }
%>

<display:table name="array" pagesize="10" defaultsort="1" defaultorder="ascending">
       <display:setProperty name="paging.banner.group_size" value="8"/>
       <display:setProperty name="paging.banner.item_name">
</display:setProperty>
       <display:setProperty   name="paging.banner.items_name">
</display:setProperty>
      <display:setProperty name="paging.banner.no_items_found">
</br></display:setProperty>
      <display:setProperty name="paging.banner.one_item_found">
</br></display:setProperty> </display:table>

  </body>
</html>

Ed!


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to