View Javadoc
1 /* 2 * ElseTag.java 3 * 4 * $Author: mballesteros $ $Date: 2004/03/10 14:22:13 $ $Revision: 1.2 $ 5 */ 6 package net.sf.ewc.taglib; 7 8 import java.util.Stack; 9 10 import javax.servlet.jsp.JspTagException; 11 12 /*** 13 * {@link ElseTag}works with the {@link IfTag}to process contents 14 * conditionally 15 * 16 * @author mballesteros 17 */ 18 public class ElseTag extends EWCTag { 19 20 /*** 21 * Main constructor 22 */ 23 public ElseTag() { 24 super(); 25 } 26 27 /*** 28 * @return 29 * @throws JspTagException 30 */ 31 public int doStartTag() throws JspTagException { 32 Stack ifStack = getStack("ifStack"); 33 if (ifStack.empty()) { 34 throw new JspTagException("ElseTag without IfTag"); 35 } 36 Object value = ifStack.pop(); 37 if (value.equals(IfTag.IF_END_TRUE)) { 38 return SKIP_BODY; 39 } else if (value.equals(IfTag.IF_END_FALSE)) { 40 return EVAL_BODY_INCLUDE; 41 } else { 42 throw new JspTagException("ElseTag without IfTag"); 43 } 44 } 45 }

This page was automatically generated by Maven