91-9990449935 0120-4256464 |
Iteration using JSP Custom TagWe can iterate the body content of any tag using the doAfterBody() method of IterationTag interface. Here we are going to use the TagSupport class which implements the IterationTag interface. For iterating the body content, we need to use the EVAL_BODY_AGAIN constant in the doAfterBody() method. Example of Iteration using JSP Custom TagIn this example, we are going to use the attribute in the custom tag, which returns the power of any given number. We have created three files here
PowerNumber.java mytags.tld Looping using Iteration Tag (creating tag for loop)Let's create a loop tag that iterates the body content of this tag. File: index.jsp
File: mytags.tld
File: Loop.java
File: web.xml
Output
Next TopicCustom Uri In Jsp Custom Tag
|