• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Custom Tag Iterator is so slow.

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Say me, please, why the custom tag which iterate the collection works so slow with big tag content. It works 5 second where the for ... construction works 1 second.
My system is Win2000 professional, jdk1.3, Resin 1.2.3.
This trouble appears also in jakarta "forEach" tag and in struts "iterate" tag.
My tag's code source is
public final class IterateTag extends BodyTagSupport {
private String id = null;
private Iterator iterator = null;
public String getId() {
return (this.id);
}
public void setId(String id) {
this.id = id;
}

public Iterator getIterator() {
return (this.iterator);
}
public void setIterator(Iterator it) {
this.iterator = it;
}

public int doStartTag() throws JspException {
if (iterator.hasNext()) {
pageContext.setAttribute(id, iterator.next());
return EVAL_BODY_TAG;
} else
return SKIP_BODY;
}

public int doAfterBody() throws JspException {
if (iterator.hasNext()) {
pageContext.setAttribute(id, iterator.next());
return EVAL_BODY_TAG;
} else
return SKIP_BODY;
}
public int doEndTag() throws JspException {
if (bodyContent != null) {
try {
JspWriter out = getPreviousOut();
out.print(bodyContent.getString());
} catch (IOException e) {
throw new JspException("End Error");
}
}
return EVAL_PAGE;
}

public void release() {
super.release();
id = null;
iterator = null;
}
}
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic