ForEachTag.doStartTag()
ForEachTag needs to define a doStartTag() method to extract the value of the in 
and iterate attributes from the attribute values. The value of in ("balances" in 
this example) is used to get at the result data.  The value of iterate ("row" in 
this example) is used as the key on which to store the iteration value.
The current value of the "out" variable is stored away so it can be used in 
doBody(). This method returns EVAL_BODY so as to force the evaluation of 
the body.
ForEachTag.doAfterBody()
The BodyContent (obtained from getBodyContent()) contains the evaluation of 
the body of the element where the evaluation has been done in a context where 
the variable "row" is assigned the different rows of the query.  This method 
now inserts this content into the surrounding out stream (obtained from 
getPreviousOut()).
This method now updates the binding of "row" and will return EVAL_BODY 
or SKIP_BODY depending on whether there were any more rows in the result 
set.
ForEachTag.doEndTag()
Just clean up.
ForEachExtraInfo()
The translation time information indicates that this action defines a new 
scripting variable, with scope NESTED and name corresponding to the value of 
the "row" attribute. 
Appendix 
136




JSP Web Hosting JavaServer Pages Specifications JSP Hosting




 
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved.