Hi

First of all, let me thank you all for the replies.

Well, I am not writing the pages or beans directly but everything is
generated. As an example I had set two components, but there may be any
number of components, therefore having the same no of binding variables is
not possible, as the backing bean and the pages need to be independent of
each other.

I gather now that what I am doing is not possible. The requirement is
actually simple. There will be say n components on the page (where n is
dynamic). All of these n components are independent of each other. Now the
requirement for each of this component is that they may or may not be
rendered at one particular time and this needs to be toggled
programatically. Therefore if the user chosses a particular value then the
component may be rendered and then depending on his next choice it may not
be rendered. Therefore i used binding to bind it to a variable and then set
the rendered value through this variable.

What is the better way to do the same.

Thanks
Varun




On Tue, Mar 25, 2008 at 7:07 PM, Martin Schlierf <[EMAIL PROTECTED]>
wrote:

> You could use 2 different beans and just link them together in the setter
> or
> something like that.
> Bean a;
> Bean b;
>
> setProp(String value) {
> a.value=value;
> b.value=value;
> }
>
> But why use binding?
> If you just want the same values in both tags, why don't you use
> value="bbean.prop".
> I don't understand why a binding is needed, but if it's the only way for
> you.
> Then you should use a linked copy.
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: Varun Shingal [mailto:[EMAIL PROTECTED]
> Gesendet: Dienstag, 25. März 2008 13:14
> An: [email protected]
> Betreff: [MyFaces] multiple components binding to same backing bean
> property
>
> Hi
>
> First a little background.I had developed a few of my own components and
> was using the myFaces-1.1.3 jars till now. Everything worked fine for
> this but I frequently got the problem of the duplicate id issue which
> has been discussed in the forum before. I therefore moved to the
> myFace-1.1.5 version and that is when the problem came up.
>
> I have developed a tag, say <a:myTag> which supports the binding
> attribute so Il have <a:myTag binding="#{bbean.prop}" value="One"/>. Now
> suppose I want to have another tag in the same jsp<a:myTag
> binding="#{bbean.prop}" value="Two"/>. Thus my jsp would have
>
> <a:myTag binding="#{bbean.prop}" value="One"/>
> <a:myTag binding="#{bbean.prop}" value="Two"/>
>
> This leads to a JasperException in the page. It worked fine with 1.1.3
> but gives the exception on moving to 1.1.5. If I remove any one of the
> lines it works fine and if i change the property "prop" to which it is
> bound then also it works fine. So something like this works:
>
> <a:myTag binding="#{bbean.prop}" value="One"/>
> <a:myTag binding="#{bbean.prop2}" value="Two"/>
>
> Any idea where I could be going wrong? Any help is appreciated.
>
> Thanks
> Varun
>
>
>

Reply via email to