public void run(JellyContext context, XMLOutput output) throws Exception {
if ( ! context.isCacheTags() ) {
clearTag();
}
try {
Tag tag = getTag();
if ( tag == null ) {
return;
}
tag.setContext(context);
if ( tag instanceof DynaTag ) {
DynaTag dynaTag = (DynaTag) tag;
// ### probably compiling this to 2 arrays might be quicker and smaller
for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
Expression expression = (Expression) entry.getValue();
Object value = expression.evaluate(context);
dynaTag.setAttribute(name, value);
}
}
else {
// treat the tag as a bean
DynaBean dynaBean = new ConvertingWrapDynaBean( tag );
for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
Expression expression = (Expression) entry.getValue();
Object value = expression.evaluate(context);
dynaBean.set(name, value);
}
}
tag.doTag(output);
}
catch (JellyException e) {
handleException(e);
}
catch (Exception e) {