1 7 package org.ejtools.servlet.http.jsp.tagext; 8 9 import javax.servlet.jsp.JspException ; 10 import javax.servlet.jsp.tagext.TagSupport ; 11 12 import org.apache.struts.util.RequestUtils; 13 14 28 public class ObjectClassTag extends TagSupport 29 { 30 31 protected String id = null; 32 33 protected String name = null; 34 35 protected String property = null; 36 37 protected String scope = null; 38 39 40 46 public int doStartTag() 47 throws JspException 48 { 49 Object object = null; 50 51 if (property != null) 53 { 54 object = RequestUtils.lookup(pageContext, this.name, this.property, this.scope); 55 } 56 else 57 { 58 object = RequestUtils.lookup(pageContext, this.name, this.scope); 59 } 60 61 if (object == null) 62 { 63 throw new JspException ("Unable to find bean " + this.name + " or its property " + this.property); 64 } 65 66 pageContext.setAttribute(this.id, object.getClass().getName()); 68 69 return (SKIP_BODY); 71 } 72 73 74 82 public String getId() 83 { 84 return this.id; 85 } 86 87 88 96 public String getName() 97 { 98 return this.name; 99 } 100 101 102 110 public String getProperty() 111 { 112 return this.property; 113 } 114 115 116 124 public String getScope() 125 { 126 return this.scope; 127 } 128 129 130 131 public void release() 132 { 133 super.release(); 134 this.id = null; 135 this.name = null; 136 this.property = null; 137 this.scope = null; 138 } 139 140 141 146 public void setId(String id) 147 { 148 this.id = id; 149 } 150 151 152 157 public void setName(String name) 158 { 159 this.name = name; 160 } 161 162 163 168 public void setProperty(String property) 169 { 170 this.property = property; 171 } 172 173 174 179 public void setScope(String scope) 180 { 181 this.scope = scope; 182 } 183 } 184 185 | Popular Tags |