1 5 package com.opensymphony.webwork.views.jsp; 6 7 import javax.servlet.jsp.JspException ; 8 9 10 14 public class ElseIfTag extends WebWorkTagSupport { 15 17 protected Boolean answer; 18 protected String test; 19 20 22 public void setTest(String test) { 23 this.test = test; 24 } 25 26 public int doEndTag() throws JspException { 27 if (answer == null) { 28 answer = new Boolean (false); 29 } 30 31 if (answer.booleanValue()) { 32 pageContext.setAttribute(IfTag.ANSWER, answer); 33 } 34 35 return SKIP_BODY; 36 } 37 38 public int doStartTag() throws JspException { 39 Boolean ifResult = (Boolean ) pageContext.getAttribute(IfTag.ANSWER); 40 41 if ((ifResult == null) || (ifResult.booleanValue() == true)) { 42 return SKIP_BODY; 43 } 44 45 answer = (Boolean ) findValue(test, Boolean .class); 47 48 if (answer != null && answer.booleanValue()) { 49 return EVAL_BODY_INCLUDE; 50 } 51 52 return SKIP_BODY; 53 } 54 } 55 | Popular Tags |