Ron Piterman <rpiterman <at> gmx.net> writes:

> Please look at the example in bug 
> http://issues.apache.org/jira/browse/TAPESTRY-406
> 
> It shows that if you use 3 components of the same type, each one has a 
> bean, whose attribute is set to a parameter of the component, the 
> *first* component's parameter will apply to all 3 beans. Thats very 
> strange, as if the three instances share the same bean without updating 
> its properties.

Has this been confirmed as a bug?

What <set> does is to evaluate a certain OGNL expression, get the 
value and set it to a property of a bean. There is no binding at 
all. Even if that OGNL expression evaluates to another value later, 
it will not affect that bean.

In Tapestry 3, here is relevant code:

public class BeanProvider {
   private Object instantiateBean(String beanName, IBeanSpecification spec)
   {
       String className = spec.getClassName();
       Object bean = null;
       Class beanClass = _resolver.findClass(className);
       bean = beanClass.newInstance();
       List initializers = spec.getInitializers();
       if (initializers == null)
           return bean;
       Iterator i = initializers.iterator();
       while (i.hasNext())
            IBeanInitializer iz = (IBeanInitializer) i.next();
            iz.setBeanProperty(this, bean);
        }
        return bean;
    }
}

public class ExpressionBeanInitializer extends AbstractBeanInitializer
{
    protected String _expression;

    public void setBeanProperty(IBeanProvider provider, Object bean)
    {
        IResourceResolver resolver = provider.getResourceResolver();
        IComponent component = provider.getComponent();
        Object value = OgnlUtils.get(_expression, resolver, component);
        setBeanProperty(resolver, bean, value);
    }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to