jakarta-watchdog-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sant...@locus.apache.org
Subject cvs commit: jakarta-watchdog-4.0/src/server/jsp-tests/WEB-INF/classes/tags SimpleIteratorTag.java
Date Thu, 30 Nov 2000 23:53:06 GMT
santosh     00/11/30 15:53:05

  Added:       src/server/jsp-tests/WEB-INF/classes/tags
                        SimpleIteratorTag.java
  Log:
  not sure if it is reqd..still commiting to be on safe side
  
  Revision  Changes    Path
  1.1                  jakarta-watchdog-4.0/src/server/jsp-tests/WEB-INF/classes/tags/SimpleIteratorTag.java
  
  Index: SimpleIteratorTag.java
  ===================================================================
  //This is a Simple Iterator tag (JSP 1.2) 
  
  package tags;
  
  import javax.servlet.*;
  import javax.servlet.jsp.tagext.*;
  import javax.servlet.jsp.*;
  import java.io.IOException ;
  
  public class  SimpleIteratorTag extends TagSupport
  {
  //This tag prints "JSP is cool" Iteratively depending on the 
  //iteration attribute
  
  protected int number_of_iterations ;
  
  public void setIteration(String num_iteration)
  {
  
  try
  {
  number_of_iterations= Integer.parseInt(num_iteration);
  }
  catch(NumberFormatException numex)
  {  number_of_iterations = 0; }
  
  }
  
  public int doStartTag()
  {
  //Evaluate the body
  return Tag.EVAL_BODY_INCLUDE ;
  }
  
  public int doAfterBody()
  {
    if(number_of_iterations > 0)
    {
       try
  	{
    		pageContext.getOut().println("JSP is cool");
    		number_of_iterations -- ;
    		return IterationTag.EVAL_BODY_AGAIN ;
    	}catch(IOException ioe) { return Tag.SKIP_BODY ;}
    }
  
    return  Tag.SKIP_BODY ;
  }
  
  public int doEndTag()
  {
  return Tag.EVAL_PAGE ;
  }
  
  
  }
  
  
  
  

Mime
View raw message