*/
public int doStartTag()
throws JspException
{
try {
PageContextImpl pageContext = (PageContextImpl) this.pageContext;
Env env = XPath.createEnv();
env.setVarEnv(pageContext.getVarEnv());
_oldEnv = pageContext.getNodeEnv();
Object obj = _select.evalObject(_oldEnv, env);
env.free();
if (obj == null)
return SKIP_BODY;
if (obj instanceof Iterator)
_iterator = (Iterator) obj;
else if (obj instanceof Collection)
_iterator = ((Collection) obj).iterator();
else if (obj instanceof NodeList) {
NodeList nodeList = (NodeList) obj;
ArrayList<Object> list = new ArrayList<Object>();
for (int i = 0; i < nodeList.getLength(); i++)
list.add(nodeList.item(i));
_iterator = list.iterator();
}
else {
ArrayList<Object> list = new ArrayList<Object>();
list.add(obj);
_iterator = list.iterator();
}
_count = 0;
while (_count < _begin && _iterator.hasNext()) {
_iterator.next();
_count++;
}
if (_end < _count || ! _iterator.hasNext())
return SKIP_BODY;
_current = _iterator.next();
Object value = _current;
_count++;
if (_var != null)
pageContext.setAttribute(_var, value);
if (_varStatus != null)
pageContext.setAttribute(_varStatus, new Status());
if (value instanceof Node)
pageContext.setNodeEnv((Node) value);
return EVAL_BODY_INCLUDE;
} catch (Exception e) {
throw new JspException(e);
}