File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ValueChangeListener for double values

 
Mathandisto Mathandistos
Greenhorn
Posts: 1
Eclipse IDE Java Windows Vista
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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">
<table>
<s:decorate id="squareMetersField" template="/layout/edit.xhtml">
<ui:define name="label">Square meters</ui:define>
<h:inputText id="squareMeters" value="#{feesCalculationHome.instance.squareMeters}"
valueChangeListener="#{feesCalculationHome.updateFeeValuesChanged}">
<a:support event="onchange" reRender="squareMetersField,totalField" bypassUpdates="true" ajaxSingle="true"/>
</h:inputText>
</s:decorate>

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

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");
((EditableValueHolder)total).setValue(squareMeters);
FacesContext.getCurrentInstance().renderResponse();
}


Thank you in advance
Mathandisto
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic