myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Schlierf" <M.Schli...@cadenas.de>
Subject AW: [MyFaces] multiple components binding to same backing bean property
Date Tue, 25 Mar 2008 13:37:54 GMT
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:varun.shingal@versata.com] 
Gesendet: Dienstag, 25. März 2008 13:14
An: users@myfaces.apache.org
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



Mime
View raw message