I've seen 2 times that a variable from a page previously browsed can interfere with or replace a variable (for example a h:datatable "var") from a page viewed downstream.
So what is the scope of ui:param ? And is there a way to contain it ?
It basically sets a new variable mapping in the EL context. See also the source code of ParamHandler
:
94 public void apply(FaceletContext ctx, UIComponent parent)
95 throws IOException {
96 String nameStr = this.name.getValue(ctx);
97 ValueExpression valueVE = this.value.getValueExpression(ctx,
98 Object.class);
99 ctx.getVariableMapper().setVariable(nameStr, valueVE);
100 }
Note line 99 (as in Mojarra 2.1.0). This retrieves the VariableMapper
from the EL context and then sets a variable mapping on it with a ValueExpression
as value.
This has basically the "global" scope. So if the variable name is "foo", then every single EL expression which is evaluated in the same EL context (basically, the current HTTP request) which ever references "foo" will be evaluated by the value expression as specified in the variable mapper. This has a higher precedence than the var
of the repeating components, if any. So this may indeed lead to conflicts and "empty" looking repeaters.
Better give either the <ui:param>
or the <h:dataTable var>
a different name. You could for example choose to prefix all <ui:param>
(and <c:set>
) variables with _
or so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With