1 18 package org.apache.beehive.netui.tags.html; 19 20 import org.apache.beehive.netui.tags.AbstractSimpleTag; 21 import org.apache.beehive.netui.tags.IAttributeConsumer; 22 import org.apache.beehive.netui.util.Bundle; 23 24 import javax.servlet.jsp.JspException ; 25 import javax.servlet.jsp.tagext.JspTag ; 26 import javax.servlet.jsp.tagext.SimpleTagSupport ; 27 28 48 public class Attribute extends AbstractSimpleTag 49 { 50 private String _name = null; 51 private String _value = null; 52 private String _facet = null; 53 54 57 public String getTagName() 58 { 59 return "Attribute"; 60 } 61 62 71 public void setName(String name) 72 throws JspException 73 { 74 _name = setRequiredValueAttribute(name, "name"); 75 } 76 77 86 public void setValue(String value) 87 { 88 _value = setNonEmptyValueAttribute(value); 89 } 90 91 100 public void setFacet(String facet) 101 throws JspException 102 { 103 _facet = setRequiredValueAttribute(facet, "facet"); 104 } 105 106 110 public void doTag() 111 throws JspException 112 { 113 if (hasErrors()) { 114 reportErrors(); 115 return; 116 } 117 118 JspTag tag = SimpleTagSupport.findAncestorWithClass(this, IAttributeConsumer.class); 119 if (!(tag instanceof IAttributeConsumer)) { 120 String s = Bundle.getString("Tags_AttributeInvalidParent"); 121 registerTagError(s, null); 122 reportErrors(); 123 return; 124 } 125 126 IAttributeConsumer ac = (IAttributeConsumer) tag; 127 ac.setAttribute(_name, _value, _facet); 128 return; 129 } 130 } 131 | Popular Tags |