In my derived Struts-EL tags, I evaluate all of the attributes of a tag in the
same way, all at the same time. Following this are some examples:
---------------
try {
setAltKey((String)ExpressionUtil.
evalNotNull("checkbox", "altKey", getAltKey(),
String.class, this, pageContext));
} catch (NullAttributeException ex) {
setAltKey(null);
}
try {
setDisabled(((Boolean)ExpressionUtil.
evalNotNull("checkbox", "disabled", getDisabled() + "",
Boolean.class, this, pageContext)).
booleanValue());
} catch (NullAttributeException ex) {
setDisabled(false);
}
try {
setCollection(ExpressionUtil.
evalNotNull("size", "collection",
getCollectionExpr(),
Object.class, this, pageContext));
} catch (NullAttributeException ex) {
setCollection(null);
}
---------------
The first two are from the same class, and the third one is from a different
class. The first attribute is just a string type. The second one is a
boolean, and the third is a Collection type (Collection or Array).
Every attribute is handled exactly this way (with a little more thought, the
derived classes could be generated from the XML files used to contain the TLD
information and the documentation).
My question to you is, is there a better and/or more efficient way to process a
bunch of EL expressions in a block? What I have is straightforward, but I'm
wondering if there is a better way to do this.
--
===================================================================
David M. Karr ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>