If you look at the example in the bug, you can see this isn't working. Its not about changing the property or binding it, but about passing a parameter to the component which is passed further to the bean.

How come this functions for the *first* component instance, while the beans in the other instances get the same value?

It not in a loop - I instanciate the component three times...

PS. no, it has not been confirmed as a bug yet-


ציטוט Kent Tong:
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]




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

Reply via email to