eclipse-ee4j / mojarra

Mojarra, a Jakarta Faces implementation
Other
162 stars 110 forks source link

EL expression in rendered attribute are evaluated during apply request values phase #478

Closed ren-zhijun-oracle closed 17 years ago

ren-zhijun-oracle commented 17 years ago

Many of my components have a rendered="..." attribute containing el expressions. I thought these expressions will be evaluated during the Render Response Phase when the actual output is rendered as that is what the attribute controls. I now noticed that these expressions are also evaluated during the Apply Request Values Phase (see stack trace fragment below). Is that expected behaviour? It causes me problems because the properties in those el expressions are coming from a request scoped bean and those properties are not correctly set at that point in time. I would have thought that the rendered state of a component would be saved in the View state and not recalculated in the early phases of the JSF life cycle.

Manuel

at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192) at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:384) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:981) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:989) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:989) at javax.faces.component.UIForm.processDecodes(UIForm.java:203) at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:989) at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:494) at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:101)

Environment

Operating System: All Platform: All

Affected Versions

[1.2_03]

ren-zhijun-oracle commented 6 years ago
ren-zhijun-oracle commented 17 years ago

@javaserverfaces Commented Reported by malm@java.net

ren-zhijun-oracle commented 17 years ago

@javaserverfaces Commented youngm said: So Ryan doesn't have to search for it I believe this is a duplicate of Issue 439.

To work around this you can use a Session scoped beans for holding the data you need persisted between states or (my personal favorite all purpose fix) use a tool like Tomahawk saveState.

ren-zhijun-oracle commented 17 years ago

@javaserverfaces Commented malm@java.net said: Not sure if its really the same as issue 439. My 'gripe' is that the JSF implementation (re)evaluates the EL expression for the rendered attribute during the apply request values phase. There shouldn't be a need to do this. The EL expression in any rendered attribute should only be evaluted during the render response phase. If the JSF implementation needs to know which components were rendered when reconstructing the view it should save that information as part of the view state.

ren-zhijun-oracle commented 17 years ago

@javaserverfaces Commented jhook said: this is no different than any other mvc environment-- what if you used something like Struts or WebWork to publish a list of things to edit and then on postback, your list no longer exists or has been modified to be out of sync with the previous view? Making a case for 'rendered' is only a niche issue-- why not all of the bindings, values on the page-- what if we saved some and not others-- wouldn't this create even more confusion? Here's to having JSF go stateless in '07

http://weblogs.java.net/blog/jhook/archive/2006/01/experiment_goin_1.html

ren-zhijun-oracle commented 17 years ago

@javaserverfaces Commented adamwiner said: This is not a JSF impl issue - it's a spec issue. The implementation is behaving as designed, and the problem is in the deisgn.

ren-zhijun-oracle commented 17 years ago

@javaserverfaces Commented @rlubke said: As a follow up, I believe the workaround I've seen posted is to call setRendered() directly on the component instead of via expression and allow state saving to take care of the rest.

ren-zhijun-oracle commented 12 years ago

@javaserverfaces Commented @manfredriem said: Closing issue out

ren-zhijun-oracle commented 17 years ago

@javaserverfaces Commented Was assigned to javaserverfowner

ren-zhijun-oracle commented 7 years ago

@javaserverfaces Commented This issue was imported from java.net JIRA JAVASERVERFACES-474

ren-zhijun-oracle commented 17 years ago

@javaserverfaces Commented Marked as won't fix on Monday, May 14th 2007, 10:19:24 am