1 18 package net.sf.uitags.tag; 19 20 import javax.servlet.jsp.JspException ; 21 import javax.servlet.jsp.tagext.Tag ; 22 23 import net.sf.uitags.tagutil.AttributeSupport; 24 import net.sf.uitags.tagutil.validation.TlvLeakageException; 25 26 33 public class AttributeTag extends AbstractUiTag { 34 35 39 42 private static final long serialVersionUID = 100L; 43 44 45 49 52 private String name; 53 56 private String value; 57 58 59 63 68 public void setName(String name) { 69 this.name = name; 70 } 71 72 77 public void setValue(String value) { 78 this.value = value; 79 } 80 81 82 86 94 public int doStartTag() throws JspException { 95 Tag parentTag = getParent(); 96 if (!(parentTag instanceof AttributeSupport)) { 97 throw new TlvLeakageException("Invalid use of tag outside " + 98 "legitimate parent tag: " + parentTag.getClass().getName()); 99 } 100 AttributeSupport attributeSupport = (AttributeSupport) parentTag; 101 attributeSupport.addAttribute(this.name, this.value); 102 103 return SKIP_BODY; 104 } 105 } 106 | Popular Tags |