}
// Push new values into the VariableMapper and the pageContext
private void _updateVars()
{
VariableMapper vm =
pageContext.getELContext().getVariableMapper();
if (_var != null)
{
// Catch programmer error where _var has been set but
// _items has not
if (_items != null)
{
ValueExpression iterated = new IndexedValueExpression(_items,
_currentIndex);
vm.setVariable(_var, iterated);
}
// Ditto (though, technically, one check for
// _items is sufficient, because if _items evaluated
// to null, we'd skip the whole loop)
Object items = _itemsValue;
if (items != null)
{
Object item;
if (items instanceof List)
item = ((List) items).get(_currentIndex);
else
item = Array.get(items, _currentIndex);
pageContext.setAttribute(_var, item);
}
}
if (_varStatus != null)
{
pageContext.setAttribute(_varStatus, _propertyReplacementMap);
ValueExpression constant = new Constants(
new HashMap(_propertyReplacementMap));
vm.setVariable(_varStatus, constant);
}
}