Donate Share

Display Tag Library

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

How to use Hash Map with Display Tag

You are viewing a single message from this topic. View all messages.

  1. 2009-06-25 15:34:54 UTC
    List<Map> model = new ArrayList<Map>();
    for (int i = 0; i < MAX_QTY; i++) {
    model.add(new HashMap());
    }

    Date a = new Date(2009,01,01);
    for (int i = 0; i < MAX_QTY; i++) {
    model.get(i).put(a, 50);
    }

    Date a = new Date(2009,01,02);
    for (int i = 0; i < MAX_QTY; i++) {
    model.get(i).put(a, 40);
    }

    etc...

    Which will create a List of Maps (each Map is a row in the table). The maps contain Date/Qty key/value pairs where the Date is a column. You then need to do as you were before; generate a <display:column> tag for each Date you've added to your maps. This should then produce the table you want. I think.

    Ed!
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.