Source code: com/obinary/cms/taglibs/IfLastContainer.java
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-2003 obinary Ltd. (http://www.obinary.com) All rights reserved.
11 *
12 * */
13
14
15
16
17
18 package com.obinary.cms.taglibs;
19
20
21
22 import javax.servlet.jsp.tagext.TagSupport;
23 import javax.servlet.jsp.PageContext;
24
25
26 /**
27 * Date: Apr 28, 2003
28 * Time: 11:20:59 AM
29 * @author Marcel Salathe
30 * @version 1.0
31 */
32
33
34 public class IfLastContainer extends TagSupport {
35
36
37
38
39 /**
40 * <p>starts ifLastContainer tag</p>
41 *
42 * @return int
43 */
44 public int doStartTag() {
45 int size = ((Integer)pageContext.getAttribute(ContainerLoop.SIZE,PageContext.REQUEST_SCOPE)).intValue();
46 int currentIndex = ((Integer)pageContext.getAttribute(ContainerLoop.CURRENT_INDEX,PageContext.REQUEST_SCOPE)).intValue();
47 if (currentIndex == (size-1))
48 return EVAL_BODY_INCLUDE;
49 return SKIP_BODY;
50 }
51
52
53
54 /**
55 * <p>continue evaluating jsp</p>
56 *
57 * @return int
58 */
59 public int doEndTag() {
60 return EVAL_PAGE;
61 }
62
63
64 }