Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 1.7.2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:ICEFaces 1.7.2 (comps; core;facelets)
JSF RI 1.2_09 (problem exists with older version as well)
Description
There is also a problem with the components state when working without weblow.
Test page setup:
[code]
<ice:outputText value="test"/>
<ice:commandButton actionListener="#{bean.toggle}"/>
[/code]
ActionListener setup:
[code]
public void action(ActionEvent actionEvent) {
for (UIComponent child : actionEvent.getComponent().getParent()
.getChildren()) {
if (child instanceof HtmlOutputText) {
HtmlOutputText output = ((HtmlOutputText) child);
if (output.isRendered()) {
output.setRendered(false);
} else {
output.setRendered(true);
}
}
}
}
[/code]
The action listener will lookup the 'outputText' and toggle its rendered attribute.
The rendered attribute is by default 'true'.
Failing test:
1. Open the page (output text is rendered = OK)
2. Click the button (output text gets hidden = OK -> implemented toggle behavior in action listener)
3. Click the button again (output text gets shown = OK -> implemented toggle behavior in action listener)
4. Click the button once more (output text gets hidden = OK ...........)
5. Now, hit F5 in browser
6. Output text gets shown (NOT OK !)
The problem here, is once again, related to setting the viewroot to NULL.
This is what happens:
1. I hit F5, browser sends GET
2. ICEFaces discovers this is a GET and sets viewroot to null
3. A clean viewroot is created by JSF
4. Components are getting bound by facelets, but there is nowhere state injected
NOTE: it works when BINDING the component to the action instead of looking it up via the component tree; when doing this the component instance is retained on the action.
The facelets componentHandler will (instead of creating a new instance) execute the binding VE pointing to the action containing the component instance.
This way the state is reatained and it appears to be working.
Test page setup:
[code]
<ice:outputText value="test"/>
<ice:commandButton actionListener="#{bean.toggle}"/>
[/code]
ActionListener setup:
[code]
public void action(ActionEvent actionEvent) {
for (UIComponent child : actionEvent.getComponent().getParent()
.getChildren()) {
if (child instanceof HtmlOutputText) {
HtmlOutputText output = ((HtmlOutputText) child);
if (output.isRendered()) {
output.setRendered(false);
} else {
output.setRendered(true);
}
}
}
}
[/code]
The action listener will lookup the 'outputText' and toggle its rendered attribute.
The rendered attribute is by default 'true'.
Failing test:
1. Open the page (output text is rendered = OK)
2. Click the button (output text gets hidden = OK -> implemented toggle behavior in action listener)
3. Click the button again (output text gets shown = OK -> implemented toggle behavior in action listener)
4. Click the button once more (output text gets hidden = OK ...........)
5. Now, hit F5 in browser
6. Output text gets shown (NOT OK !)
The problem here, is once again, related to setting the viewroot to NULL.
This is what happens:
1. I hit F5, browser sends GET
2. ICEFaces discovers this is a GET and sets viewroot to null
3. A clean viewroot is created by JSF
4. Components are getting bound by facelets, but there is nowhere state injected
NOTE: it works when BINDING the component to the action instead of looking it up via the component tree; when doing this the component instance is retained on the action.
The facelets componentHandler will (instead of creating a new instance) execute the binding VE pointing to the action containing the component instance.
This way the state is reatained and it appears to be working.
Can you explain how you fixed this ?
I looked at the changes you made in
ICE-3691but I cannot conduct that this issue here would be fixed...Thanks.