On Tue, 13 Mar 2001, Johan Compagner wrote:

> Hi,
> 
> If i specify the value in the DefineTag then the name/property is ignored!!
> But when i also specify the name/property then i want the value to be filled in when
> name/property seems to be null!
> 

If you specify the "value" attribute:

        <bean:define id="xyz" value="this is a value"/>

you are saying that you want to create a bean under key "xyz" with the
specified literal String value "this is a value".  That is why any
"name" or "property" attributes are ignored.

> so not:
> 
>  // Retrieve the required property value
>  Object value = this.value;

This will return null if you did not specify a "value" attribute, so the
effect is the same as your desired result -- setting the new bean based on
the name/property combination.

>  if (value == null)
>   value = RequestUtils.lookup(pageContext, name, property, scope);
> 
> but:
> 
>  // Retrieve the required property value
>  Object value = null;
> if(name != null)
>     value = RequestUtils.lookup(pageContext, name, property, scope);
>  if (value == null)
>   value = this.value;
> 

This would reverse the priority of lookups, and make the string you
specified for the "value" essentially a default if the specified property
returns null.  That is different from the current behavior, and different
from what is documented, but makes a certain kind of sense.

What do people think about changing this?

> johan
> 
> 
> 

Craig


Reply via email to