File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes ValueChangeListener for double values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "ValueChangeListener for double values" Watch "ValueChangeListener for double values" New topic

ValueChangeListener for double values

Mathandisto Mathandistos

Joined: Jan 25, 2011
Posts: 1


I am hoping someone will be able to assist, I am new to jsf and i'm having difficulties with valuechangelistener.

For some odd reason, it's not rendering the total field with the new value. Did I perhaps miss something?

Your assistance will be much appreciated.

in my feesCalculationEdit.xhtml I have

h:form id="feesCalculation">
<s:decorate id="squareMetersField" template="/layout/edit.xhtml">
<ui:define name="label">Square meters</ui:define>
<h:inputText id="squareMeters" value="#{feesCalculationHome.instance.squareMeters}"
<a:support event="onchange" reRender="squareMetersField,totalField" bypassUpdates="true" ajaxSingle="true"/>

<s:decorate id="totalField" template="/layout/edit.xhtml">
<ui:define name="label">Total</ui:define>
R<h:inputText id="total" value="#{}">
<a:support event="onblur" reRender="totalField" bypassUpdates="true" ajaxSingle="true"/>

and in my feesCalculationHome bean I have

Map<Double, UIComponent> UIComponent;
public void updateFeeValuesChanged(ValueChangeEvent event) {
System.out.println("A value has changed!");
Double oldSquareMeters = ((double) event.getOldValue()).doubleValue();
Double squareMeters = ((double) event.getNewValue()).doubleValue();
System.out.println("OLD squareMeters = " + oldSquareMeters);
System.out.println("squareMeters = " + squareMeters );
javax.faces.component.UIComponent total = event.getComponent().findComponent(":feesCalculation:totalField:total");

Thank you in advance
I agree. Here's the link:
subject: ValueChangeListener for double values
It's not a secret anymore!