Iterating with tags 101 } protected void parseElements()
Iterating with tags 101 } protected void parseElements() throws JspException { List l = new LinkedList(); StringTokenizer st = new StringTokenizer(elements, “,”); e while(st.hasMoreTokens()) { l.add(st.nextToken()); } elementsList = l.iterator(); } public int doAfterBody() throws JspException { try { getBodyContent().writeOut(getPreviousOut()); getBodyContent().clear(); } catch(java.io.IOException ioe) { // User probably disconnected … log(ls.getStr(Constants.IO_ERROR), ioe); throw new JspTagException(ls.getStr(Constants.IO_ERROR)); } f if(elementsList.hasNext()) { g pageContext.setAttribute(id, elementsList.next()); return EVAL_BODY_TAG; } return SKIP_BODY; } protected void clearProperties() { id = null; elements = null; super.clearProperties(); } protected void clearServiceState() { elementsList = null; } } B Parses the list of strings into a Java list and creates an enumerator. C If we have an element in the list, continues the body evaluation; otherwise skips the body (empty iteration). D Sets the iterator variable with the first element in the list.
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Java Web Hosting services