-
1. Rich suggestionbox issue with f:setPropertyActionListener
ilya40umov Feb 9, 2011 8:22 AM (in response to marczeeee)Please, provide a sample of your code.
-
2. Re: Rich suggestionbox issue with f:setPropertyActionListener
marczeeee Feb 9, 2011 9:14 AM (in response to ilya40umov)This is the code used in portlets. We just include it where it's needed.
{code:xml}
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<h:panelGroup>
<a4j:region id="region">
<table>
<tr>
<td><h:outputText value="*" rendered="#{required}" /></td>
<td><h:outputLabel for="#{componentId}" value="#{label}" title="#{title}" /></td>
<td><h:inputText id="#{componentId}"
required="#{required and !readonly}" readonly="#{readonly}"
maxlength="#{maximum}" title="#{title}" >
</h:inputText>
<rich:suggestionbox for="#{componentId}" var="userActor"
suggestionAction="#{suggestionBean.autoCompleteActor}" width="350"
minChars="3" nothingLabel="#{msgCommon['noMatchesFound']}"
ignoreDupResponses="true">
<h:column>
<h:outputText value="#{userActor.value}" />
</h:column>
<h:column>
<h:outputText value="#{userActor.label}" />
</h:column>
<a4j:support event="onselect" ajaxSingle="true">
<f:setPropertyActionListener target="#{targetProperty}" value="#{userActor.value}" />
</a4j:support>
</rich:suggestionbox></td>
<td width="28">
<a4j:status for="region">
<f:facet name="start">
<h:graphicImage value="/images/actions/suggestionStatus.gif"
style="padding-left: 3px;" />
</f:facet>
</a4j:status>
</td>
</tr>
</table>
</a4j:region>
</h:panelGroup>
</ui:composition>
{code}
The problem is that the #{userActor.value} expression expressed to a null value when the target property's setter is called. But the value is valid and not null as it is displayed by the suggestionbox as a result.
-
3. Re: Rich suggestionbox issue with f:setPropertyActionListener
ilya40umov Feb 9, 2011 9:15 AM (in response to marczeeee)Please try a4j:actionparam instead of
f:setPropertyActionListener
-
4. Re: Rich suggestionbox issue with f:setPropertyActionListener
marczeeee Feb 10, 2011 3:04 AM (in response to ilya40umov)I changed the setPropertyActionListener to a4j:actionparam, but no success. The property's setter method didn't even get called. Used it the following way:
{code:xml}<a4j:actionparam name="userActor" value="#{userActor.value}" assignTo="#{targetProperty}"/>{code}
Tried to set the surrounding a4j:support tag's ajaxSingle and immediate attributes, but nothing changed.
-
5. Re: Rich suggestionbox issue with f:setPropertyActionListener
marczeeee Feb 10, 2011 4:56 AM (in response to ilya40umov)Some more info about a4j:actionparam I found out: tried to use it without the assignTo parameter to set a request parameter value and process that with a method in my backing bean. If I use a static value as value parameter of the a4j:actionparam it works properly. But if I put an EL expression as value I only get an empty string as request parameter value.
-
6. Re: Rich suggestionbox issue with f:setPropertyActionListener
marczeeee Feb 10, 2011 6:43 AM (in response to marczeeee)Ok, I found the solution: we had the following context-param in our web.xml:
{code:xml}
<context-param>
<param-name>facelets.BUILD_BEFORE_RESTORE</param-name>
<param-value>true</param-value>
</context-param>{code}
After deleting this, everything works as expected.