This discussion is archived
2 Replies Latest reply: Nov 21, 2003 9:43 AM by 55663 RSS

Table Record Navigation - Struts

331500 Newbie
Currently Being Moderated
I have a button called "List" when I click that button it activates an Struts Action, which returns me a ArrayList of JavaBeans (User Records)

When I use this list directly in my tableData everything works fine. Now I wanted to include record Navigation.

Here is my event Hanlder
  public static EventResult doGotoEvent(BajaContext bc, Page page,
                                        PageEvent event)
  {
    // if this is a "goto" event, then we need to get the "value" parameter to
    // figure out what our start index is. If this is not a "goto" event, then
    // we want to start at index "1"
    System.out.println("Testing from UIX Provider");
    String valueParam = ((event!=null) &&
                         UIConstants.GOTO_EVENT.equals(event.getName()))
                      ? event.getParameter(UIConstants.VALUE_PARAM)
                        : "1";

    // the "value" parameter starts at "1"; however, our data is zero based,
    // so adjust the offset
    int value = Integer.parseInt(valueParam)-1;
//getting the List of Users(ArrayList) from session   
 List userList = (ArrayList)bc.getServletRequest().getSession().getAttribute(IConstants.USER_LIST_SUCCESS);
    Vector myVec = new Vector(userList);
    ListDataObjectList LDOL = new ListDataObjectList(myVec);
    DataObjectList tableData = new PagedDataObjectList(LDOL,
        _BLOCK_SIZE.intValue(),
        value); //start index

    // in a more efficient implementation, we would not use DictionaryData;
    // instead, we would implement our own DataObject
    DictionaryData data = new DictionaryData();
    // we need to add one here, since our data is zero based, but the table
    // start index must start at 1
    data.put("value", new Integer(value+1));
    data.put("size", _BLOCK_SIZE);
    data.put("maxValue", new Integer(LDOL.getLength()));
    data.put("current", tableData);

    EventResult result = new EventResult(page);
    result.setProperty("tableData", data);
    return result;
  }
My Table declaration looks like this
 <table name="userListTable"
                             data:tableData="current@tableData@ctrl:eventResult"
                               width="300" nameTransformed="false"
                               data:blockSize="size@tableData@ctrl:eventResult"
                               data:maxValue="maxValue@tableData@ctrl:eventResult"
                               data:value="value@tableData@ctrl:eventResult"
                               minValue="1">
Event registration for Goto Looks like
    <event name="goto">
      <method class="UIXProvider" method="doGotoEvent"/>
    </event>
However the event is not getting fired when I click the "List" button. I am sure the Struts action is returning the list but the goto event is not being triggered the first so that the tableData is set into the event results?

Any work around for this issue?
  • 1. Re: Table Record Navigation - Struts
    331500 Newbie
    Currently Being Moderated
    Just little more Information that I am using UIX 2.1.7 and not 2.2.

    When I click the List Button I am calling a struts action which sets an ArrayList to session.

    In my UIX page how can get it to work for Record Navigation, becuase the Struts action is going to call "success" action forward and the event "goto" will not be fired the first time and the tableData is not set in the eventResult. How can I over comes.

    Please help me...
  • 2. Re: Table Record Navigation - Struts
    55663 Newbie
    Currently Being Moderated
    can you provide the uix that defines the list button so
    I can see how you have hooked it up?