1 5 package com.opensymphony.webwork.views.jsp; 6 7 import javax.servlet.jsp.JspException ; 8 9 10 14 public class IfTag extends WebWorkTagSupport { 15 17 public static final String ANSWER = "webwork.if.answer"; 18 19 21 Boolean answer; 22 String test; 23 24 26 public void setTest(String test) { 27 this.test = test; 28 } 29 30 public int doEndTag() throws JspException { 31 pageContext.setAttribute(ANSWER, answer); 32 33 return SKIP_BODY; 34 } 35 36 public int doStartTag() throws JspException { 37 answer = (Boolean ) findValue(test, Boolean .class); 38 39 if (answer == null) { 40 answer = Boolean.FALSE; 41 } 42 43 if (answer.booleanValue()) { 44 return EVAL_BODY_INCLUDE; 45 } else { 46 return SKIP_BODY; 47 } 48 } 49 } 50 | Popular Tags |