in core/src/main/java/org/apache/commons/jelly/tags/core/SetTag.java [64:102]
public void doTag(XMLOutput output) throws JellyTagException {
// perform validation up front to fail fast
if ( var != null ) {
if ( target != null || property != null ) {
throw new JellyTagException( "The 'target' and 'property' attributes cannot be used in combination with the 'var' attribute" );
}
}
else {
if ( target == null ) {
throw new JellyTagException( "Either a 'var' or a 'target' attribute must be defined for this tag" );
}
if ( property == null ) {
throw new JellyTagException( "The 'target' attribute requires the 'property' attribute" );
}
}
Object answer = null;
if ( value != null ) {
answer = value.evaluate(context);
if (defaultValue != null && isEmpty(answer)) {
answer = defaultValue.evaluate(context);
}
}
else {
answer = getBodyText(isEncode());
}
if ( var != null ) {
if ( scope != null ) {
context.setVariable(var, scope, answer);
}
else {
context.setVariable(var, answer);
}
}
else {
setPropertyValue( target, property, answer );
}
}