1

I use an outputText to display a value of a calculation. I added a commandButton to reset the value.

 <h:outputText id="lost" value="#{calculation.lost}" ></h:outputText>
 <h:commandButton id="resetLost" value="Reset" action="#{calculation.setLost(0.0)}"></h:commandButton>

The setLost method just executes a code insertion like this: lost=lost.

I assumed that the outputText would be updated automatically but the value doesn't change. I tried also to refresh the page automatically without effect. Also I tried to use javascript.

Is it possible that the commandButton action to not be executed? And why? What is wrong in this piece of code?

Rasabihari Kumar
  • 491
  • 1
  • 4
  • 16
b10n1k
  • 567
  • 5
  • 21
  • what about your bean ?please be more specific – mstzn Oct 17 '12 at 07:27
  • Put a breakpoint in your action to see if it gets called. – f_puras Oct 17 '12 at 08:51
  • @mstzn What about the bean? it gets the variable "lost" and defined setter/getter as well. – b10n1k Oct 17 '12 at 09:31
  • I mean you should show your calculation class.and please do what @f_puras said – mstzn Oct 17 '12 at 10:11
  • Please go through http://stackoverflow.com/questions/2118656/hcommandlink-hcommandbutton-is-not-being-invoked Perhaps you just didn't have a form at all or a conversion/validation error has occurred? Anyway, just doing some basic HTTP and Java debugging so that you can track what got executed or not should already give a lot of insight. – BalusC Oct 17 '12 at 11:07
  • Less likely but maybe the reason of not working could be `lost = lost` in setter method, correct it as `this.lost = lost` :). – Uluk Biy Oct 17 '12 at 14:21
  • Sorry but i didnt managed to debug the application appropriately. I used Netbean for this purpose and I couldnt find the variables. I am not used to debug web apps. I dont know how to continue. – b10n1k Oct 21 '12 at 10:46

0 Answers0