KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > taglibs > IfLastContentNode


1 /**
2  *
3  * Magnolia and its source-code is licensed under the LGPL.
4  * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
5  * When copying, adapting, or redistributing this document in keeping with the guidelines above,
6  * you are required to provide proper attribution to obinary.
7  * If you reproduce or distribute the document without making any substantive modifications to its content,
8  * please use the following attribution line:
9  *
10  * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights reserved.
11  *
12  */

13 package info.magnolia.cms.taglibs;
14
15 import javax.servlet.jsp.PageContext JavaDoc;
16 import javax.servlet.jsp.tagext.TagSupport JavaDoc;
17
18
19 /**
20  * @author Marcel Salathe
21  * @author Fabrizio Giustina
22  * @version $Id $
23  */

24 public class IfLastContentNode extends TagSupport JavaDoc {
25
26     /**
27      * Stable serialVersionUID.
28      */

29     private static final long serialVersionUID = 222L;
30
31     /**
32      * @see javax.servlet.jsp.tagext.Tag#doStartTag()
33      */

34     public int doStartTag() {
35         int size = ((Integer JavaDoc) pageContext.getAttribute(ContentNodeIterator.SIZE, PageContext.REQUEST_SCOPE)).intValue();
36         int currentIndex = ((Integer JavaDoc) pageContext.getAttribute(
37             ContentNodeIterator.CURRENT_INDEX,
38             PageContext.REQUEST_SCOPE)).intValue();
39         if (currentIndex == (size - 1)) {
40             return EVAL_BODY_INCLUDE;
41         }
42         return SKIP_BODY;
43     }
44
45     /**
46      * @see javax.servlet.jsp.tagext.Tag#doEndTag()
47      */

48     public int doEndTag() {
49         return EVAL_PAGE;
50     }
51 }
52
Popular Tags