I'm in a situation, where I need to pass a variable to some dialog(in custom tag component), the field with the value should be editable, but the dialog shouldn't be able to modify the original value in the managed bean.
This is how I call the component:
<my:aerodromeSelection value="#{fpl.adepIcaoId}" id2="adep"/>
This is fragment of the composite component(only relevant parts included):
<composite:interface>
<composite:attribute name="id2" required="true"/>
<composite:attribute name="value" required="true"/>
</composite:interface>
<composite:implementation>
<p:panelGrid>
<p:commandButton icon="ui-icon-search" update="#{cc.attrs.id2}_dialog" oncomplete="#{cc.attrs.id2}_dialogAerodrome.show()"/>
</p:panelGrid>
<p:dialog widgetVar="#{cc.attrs.id2}_dialogAerodrome" dynamic="true">
<p:panelGrid>
<p:inputText value="#{cc.attrs.value.icaoCode}"/>
</p:panelGrid>
</p:dialog>
</composite:implementation>
After clicking the button, the dialog is shown and I can edit the value. The problem is, that I don't want the value to be set to the original variable. I tried setting the value to the managed bean of the custom component and use those values instead, but if I do it like this, then having multiple dialogs in one page, I always get the value of the last one:
<c:set value="#{cc.attrs.value.icaoCode}" target="#{adSearchBB}" property="icaoCode"/>
So I need to solve one of two problems:
- Why is the value in the adSearchBB(RequestScoped, but I've also tried ViewScoped) shared among all dialogs
- How to "unbind" the variable passed to custom component
Also, what should be the scope of the managed bean? I'd ideally want one bean per component.
I'm using
- Primefaces 3.5
- Apache MyFaces 2.1.10