Une action opérant une addition sur deux opérandes qui doivent être obligatoirement spécifié package com.BSHome.jsp.tags; 
        
import java.io.*; 
import javax.servlet.http.*; 
import javax.servlet.jsp.*; 
import javax.servlet.jsp.tagext.*; 
        
public class tagAdder extends TagSupport  
{ 
   private int operand_1; 
   private int operand_2; 
        
   public void setOperand_1 (int value_1) { this.operand_1 = value_1; } 
   public void setOperand_2 (int value_2) { this.operand_2 = value_2; }    
        
   /**  
    * Dans ce cas, ce n’était pas nécessaire de la surcharger 
    * TagSupport.doStartTag() aurait suffit 
    * @return Tag.SkipBody car l’action est sans corps 
    */ 
    public int doStartTag()  
       throws JspException  
    { 
       return SKIP_BODY; 
    } 
           
    /** 
     * @return Tag.EVAL_PAGE pour évaluer le restant de la page JSP 
     */ 
    public int doEndTag()  
       throws JspException  
    { 
       try 
       { 
           JspWriter myOut = pageContext.getOut();        
           MyOut.println(  
              Integer.toString( operand_1 ) 
            + " + " 
            + Integer.toString( operand_2 )                     
            + " = " 
            + Integer.toString( operand_1 + operand_2 ) 
                        ); 
       } 
       catch (IOException e) {} 
              
       return EVAL_PAGE; 
    } 
           
   /**  
    * Dans ce cas, ce n’était pas nécessaire de la surcharger 
    * TagSupport.release() aurait suffit 
    */ 
    public void release() 
    { 
       super.release(); 
    } 
} 
   La description de la balise pour cette action qui doit faire partie du fichier global ... 
<tag> 
   <name>Adder</name> 
   <tagclass>com.BSHome.jsp.tags.tagAdder</tagclass> 
   <bodycontent>empty</bodycontent> 
   <info>Add two operands</info> 
   <attribute> 
      <name>operand_1</name> 
      <required>true</required> 
   </attribute> 
   <attribute> 
      <name>operand_2</name> 
      <required>true</required> 
      <rtexprvalue>true</rtexprvalue> 
   </attribute> 
</tag>         
... 
 
  |