// Add one option per link, but only go up to the "maxVisited"
// value. (BTW, since maxVisited is 1-indexed, but i is 0-indexed,
// this is an _inclusive_ range here)
for (int i = 0; i < maxVisited; i++)
{
DataObject link = links.getItem(i);
MarlinBean option = new MarlinBean(OPTION_NAME);
option.setAttributeValue(TEXT_ATTR,
link.selectValue(context, TEXT_ATTR));
option.setAttributeValue(VALUE_ATTR, IntegerUtils.getString(i + 1));
if (currentValue == i + 1)
option.setAttributeValue(SELECTED_ATTR, Boolean.TRUE);
choice.addIndexedChild(option);