inputText in dataTable not executing valueChangeListener
I cannot get the valueChangeListener method to be executed from an inputtext, which is inside a datatable. I can execute the valueChangeListener
from any other inputext in the jsp. I know it's posting, I can see the request hitting the server, but the backing bean method is never invoked. Any ideas why?
Thanks!!!!
I have the following code in my jsp:
<h:dataTable value="#{manualEntryBackingBean.offerDetails}"
width="100%" var="offerDetails" border="1" style="text-align:center;">
<h:column>
<f:facet name="header">
<h:outputText value="Point Award" />
</f:facet>
<h:inputText value="#{offerDetails.pointAward}" onchange="submit();"
valueChangeListener="#{manualEntryBackingBean.processOfferPointValueChanged}"/>
</h:column>
</h:dataTable>
Here is the valueChangeListener code in my backing bean:
publicvoid processOfferPointValueChanged(ValueChangeEvent event){
final String s = event.getNewValue().toString();
LOGGER.debug("Offer value: "+s);
UIComponent uic = event.getComponent();
LOGGER.debug("..............."+uic.toString());
UIComponent uicParent = uic.getParent();
LOGGER.debug("..............."+uicParent.toString());
}
# 4
The backing bean is session scoped:
<managed-bean>
<managed-bean-name>manualEntryBackingBean</managed-bean-name>
<managed-bean-class>manualEntry.web.ManualEntryBackingBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>userBean</property-name>
<value>#{sessionScope.userBean}</value>
</managed-property>
</managed-bean>
In the manualEntry.web.manualEntryBackingBean object,
I have member, which is a java.util.List. I'm guessing because it is a
member of the backing bean, which is session scoped, then the list is
session scoped.
# 5
is the backing bean implementing ValueChangeListener interface. here is what i do for value change inside a datatable and it works perfectly fine:
public class EmployeeBO implements ValueChangeListener{
public void processValueChange(ValueChangeEvent ve) {
String value = "";
value = (String)ve.getNewValue();
MyItem item = (MyItem)modelTable.getRowData();
...
}
}
and in the JSP,
<h:dataTable id="employees" value="#{employeeBO.model}" binding="#{employeeBO.modelTable}" var="item">
<h:column>
<f:facet name="header">
<h:outputText styleClass="outputText" value="Emp No" id="text2">
</h:outputText></f:facet>
<h:inputText styleClass="inputText" id="empNbr"value="#{item.empNbr}" valueChangeListener="#{employeeBO.processValueChange}" onblur="submit();"></h:inputText
></h:column>
....
# 6
My backing bean doesn't implement the ValueChangeListener interface. I didn't realize it had to. I thought I could just do this:
<h:inputText value="#{offerDetails.pointAward}" onblur="submit();" valueChangeListener="#{manualEntryBackingBean.processOfferPointValueChanged}"/>
I don't understand why this works, outside of a datatable:
<h:inputText onblur="submit();" tabindex="2" value="#{manualEntryBackingBean.member.id}" valueChangeListener="#{manualEntryBackingBean.processOfferPointValueChanged}" />
But the same valuechangelistener inside a datatable doesn't work.
I'm thinking is has to do with using binding, which I'm not.
From your example:
<h:dataTable id="employees" value="#{employeeBO.model}" binding="#{employeeBO.modelTable}" var="item">
I'm new with JSF, and I know I'm missing something.
Thanks for the help!!!