KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > jwi > jgallery > tags > CounterTag


1 package de.jwi.jgallery.tags;
2
3 /*
4  * jGallery - Java web application to display image galleries
5  *
6  * Copyright (C) 2004 Juergen Weber
7  *
8  * This file is part of jGallery.
9  *
10  * jGallery is free software; you can redistribute it and/or modify it under the terms of the GNU General Public
11  * License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later
12  * version.
13  *
14  * jGallery is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
15  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU General Public License along with jGallery; if not, write to the Free
19  * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston
20  */

21
22 import java.io.IOException JavaDoc;
23
24 import javax.servlet.jsp.JspWriter JavaDoc;
25 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
26
27 /**
28  * @author Juergen Weber Source file created on 10.03.2004
29  *
30  */

31 public class CounterTag extends TagSupport JavaDoc
32 {
33
34     private int counter = 0;
35
36     public int doStartTag()
37     {
38         System.out.println("CounterTag.doStartTag()");
39         try
40         {
41             JspWriter JavaDoc out = pageContext.getOut();
42             out.print(counter++);
43         }
44         catch (IOException JavaDoc ioe)
45         {
46             System.out.println("Error generating prime: " + ioe);
47         }
48         return (SKIP_BODY);
49     }
50
51 }
52
Popular Tags