1 package fr.improve.struts.taglib.layout; 2 3 import javax.servlet.jsp.JspException ; 4 5 import fr.improve.struts.taglib.layout.util.FormUtilsInterface; 6 import fr.improve.struts.taglib.layout.util.LayoutUtils; 7 11 public class ModeTag extends javax.servlet.jsp.tagext.TagSupport { 12 private String value =""; 13 public int doStartTag() throws JspException { 14 int lc_mode = LayoutUtils.getSkin(pageContext.getSession()).getFormUtils().getFormDisplayMode(pageContext); 15 boolean lc_include = false; 16 switch (lc_mode) { 17 case FormUtilsInterface.CREATE_MODE: 18 if (value.indexOf("create")!=-1) { 19 lc_include = true; 20 } 21 break; 22 case FormUtilsInterface.EDIT_MODE: 23 if (value.indexOf("edit")!=-1) { 24 lc_include = true; 25 } 26 break; 27 case FormUtilsInterface.INSPECT_MODE: 28 if (value.indexOf("inspect")!=-1) { 29 lc_include = true; 30 } 31 break; 32 } 33 34 if (lc_include) { 35 return EVAL_BODY_INCLUDE; 36 } else { 37 return SKIP_BODY; 38 } 39 } 40 45 public java.lang.String getValue() { 46 return value; 47 } 48 public void release() { 49 super.release(); 50 value = ""; 51 } 52 56 public void setValue(java.lang.String newValue) { 57 if (value!=null) { 58 value = newValue.toLowerCase(); 59 } else { 60 value = ""; 61 } 62 } 63 } 64 | Popular Tags |