• Post Reply Bookmark Topic Watch Topic
  • New Topic

getCurrentValue() returning an old value! a4j and JSF 1.2. Help needed ASAP!  RSS feed

Ravi Chilakapati
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have our own set of custom components tightly coupled with the mojarra implementation of JSF 1.2. And these components were ajaxified some time back.
Now lets say I have a form with a text input field.
<myns:myCustComp id="asdh" value="#{somebean.somefield}" readonly="true"/> followed by an a4j button.
Now lets say that I input some text into it (for eg: MOOSE) and click on the button which basically only submits this text input and re-Renders it(the text input).
So now, the string field somebean.somefield has been set to MOOSE. We go through the usual motions, and when the page is ready we do the same thing again, except that we now enter a new value in the text input (for eg. SALOON).

The field somebean.somefield should be set to SALOON. Also, the component should get updated with its value set to SALOON. Page should re-render (ajax!) with text input showing SALOON.

The field somebean.somefield is being set to SALOON. The component's value is still MOOSE. Page re-renders with text input showing MOOSE.

I initially thought it was because of the readonly="true" attribute. So I set it to false, and later removed it totally. And yet, the same behaviour continued.
Then I thought that something was wrong with the renderer of the custom component. But it was and still works fine for most of the other pages - both ajax and non-ajax!
And there is not one error message through out.

We are using com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue() to extract the latest value in the encodeBegin() of the text input component.
a) Why is the component tree not being updated with the latest values? As far as my understanding goes, that is one of the first things done in the ApplyRequestValues phase of the JSF lifecycle. What kind of scenarios is this possible in?
b) The strange part is that if I have an output label custom component(again our own custom component) right next to the text input field, the output label shows the correct value (SALOON) and the text input component shows the old value (MOOSE) - in the same page, in the same form and same tab!!!. How is this possible?!

I will be grateful if someone can give me a quick and reasonable response!
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!