Hi,
I'm currently working on a JSF 1.2 project (IBM implementation and a "company layer").
PROBLEM
Here's the situation (numbers of items are just for the example), simple CRUD
- List item
- I have a list of items
- I click on item 2 to see detail
- I click on modify, the modification page displays values of item 2
- Back to the list with a button "Back" and
immediate="true"
(because we don't want to submit the modifications) - Detail of item 4
- Modify item 4 > Values of item 2 are displayed
BUT
- if I set the "immediate" attribute of the "Back" button to
false
, values of item 4 are OK. - if I set the "disabled" attibute of an inputText component to
true
, value of item 4 is OK. - if I use
<h:outputText value="#{item4.myValue}/>
(UIOutput) instead of<h:inputText value="#{item4.myValue}/>
(UIInput)
Also, I checked in debug mode that the bean I wanted to display was "item 4" and it was.
WHAT I FOUND
After some research on Google I found that this problem comes from the lifecycle of JSF, although the documentation and solutions found are for specific implementations of JSF. So I guess it's because the value is populated with "localValue" instead of "submittedValue" (@see EditableValueHolder interface could help understanding), and there are some solutions from these pages
RESULT
It doesn't work (I wouldn't be here, I swear ^^).
The "Refresh" solution is ineffective.
The "Erase input" is scary. I can't admit that I need to reference every input field! Plus I didn't find the setSubmittedValue()
method on the UIInput in my IBM JSF.
The "Clear" method is ineffective. I tried on one element, and on the complete component tree with this code
public void cleanAllChildren(List<UIComponentBase> list){
for(UIComponentBase c : list){
this.cleanAllChildren(c.getChildren());
c.getChildren().clear();
}
}
But without success. So here I am. Did I miss something? is there a nice tricky solution I didn't see? I'm not really familiar with the JSF lifecycle.