Generalized iterating tags Listing 10.4 Source code for

CHAPTER 10 Iterating with tags is custom built to handle a particular iterator type and a particular type of object in that iterator. Export a different set of JSP variables. Whenever IterationTagSupport wants to export its iterator value, it should call yet another method that can be overridden by the specialized tag (but the default implementation of the variable exportation method should export only a single iterator). IterationTagSupport s implementation IterationTagSupport was created with a few methods that may be overridden by specialized iteration tags. Listing 10.5 Source code for the generic iteration tag handler package book.iteration; import book.util.LocalStrings; import book.util.ExBodyTagSupport; import javax.servlet.jsp.JspException; public abstract class IterationTagSupport extends ExBodyTagSupport { static LocalStrings ls = LocalStrings.getLocalStrings(IterationTagSupport.class); IterationSupport elementsList = null; public int doStartTag() throws JspException { fetchIterationSupport(); if(elementsList.hasNext()) { return EVAL_BODY_TAG; } return SKIP_BODY; } public void doInitBody() throws JspException { exportVariables(); } public int doAfterBody() throws JspException { try { getBodyContent().writeOut(getPreviousOut()); getBodyContent().clear(); } catch(java.io.IOException ioe) {

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost JSP Web Hosting services

Bookmark the permalink.

Comments are closed.