Can I use <f:setPropertyActionListener> inside an autoComplete component?
The autoComplete uses the managedbean mbAC for example and I want to send the cliCod from it to another bean with:
<f:setPropertyActionListener target="#{targetBean.cliCod}" value="#{mbAC}" />
Is <f:setPropertyActionListener> the right way to do this?
The
<f:setPropertyActionListener>works only inside a component implementingActionSourceinterface, such as<h:commandButton>,<h:commandLink>. It’s unclear what autocomplete component you’re talking about, but the PrimeFaces<p:autoComplete>doesn’t implement it.You need to look for an alternate solution, such as placing the bean in the right scope and/or using
@ManagedPropertyand/or using<p:ajax>instead. The exact solution depends on the concrete functional requirement which you didn’t tell anything about.In the future questions it would be more helpful for us and yourself if you ask how to achieve the given functional requirement instead of asking how to achieve a solution of which you thought that it’s the right solution but which after all isn’t.