KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > test > taglibrary > handlers > HelloSimpleTagHandler


1 /*
2  * HelloSimpleTagHandler.java
3  *
4  * Created on 07 January 2005, 14:41
5  */

6
7 package org.netbeans.test.taglibrary.handlers;
8
9 import javax.servlet.jsp.tagext.*;
10 import javax.servlet.jsp.JspWriter JavaDoc;
11 import javax.servlet.jsp.JspException JavaDoc;
12
13 /**
14  *
15  * @author Administrator
16  * @version
17  */

18
19 public class HelloSimpleTagHandler extends SimpleTagSupport {
20
21     /**
22      * Initialization of name property.
23      */

24     private java.lang.String JavaDoc name;
25     
26     /**Called by the container to invoke this tag.
27      * The implementation of this method is provided by the tag library developer,
28      * and handles all tag processing, body iteration, etc.
29      */

30     public void doTag() throws JspException JavaDoc {
31         
32         JspWriter JavaDoc out=getJspContext().getOut();
33         
34         try {
35             out.println("<h3>Hello " + name + "</h3>");
36             
37             out.println("<pre>BODY:");
38             
39             JspFragment f=getJspBody();
40             if (f != null) f.invoke(out);
41             
42             out.println("\nEND</pre>");
43             
44         } catch (java.io.IOException JavaDoc ex) {
45             throw new JspException JavaDoc(ex.getMessage());
46         }
47         
48     }
49
50     /**
51      * Setter for the name attribute.
52      */

53     public void setName(java.lang.String JavaDoc value) {
54         this.name = value;
55     }
56 }
57
Popular Tags