I was not able to reproduce this problem using Facelets
1.1.11 and Sun RI 1.2_04-b10. Which versions of the
software are you using?
Ray
-----Original Message-----
From: Denny Strietzbaum [mailto:mailinglists fluxmux.de]
Sent: Thursday, October 11, 2007 03:30
To: users facelets.dev.java.net
Subject: TagHandlers, Compiletime/Rendertime and State of
ValueExpressions
Hi,
i've come to an issue which can be shortened to the example
below:
1)
A Taghandler which does nothing more than setting a variable
"myVar"
with a random value:
public void apply(FaceletContext faceletcontext, UIComponent
uicomponent)
throws IOException, FacesException, FaceletException,
ELException {
faceletcontext.setAttribute("myVar",
String.valueOf(Math.random()));
}
2)
A xhtml which displays this Variable.
<h:form>
<xy:myTag />
<h:outputText value="#"/>
<h:commandLink value="post"/>
<h:form>
What happens is that with every post the outputtext
component displays
always
the same value (the firstly created random)
My first thought: the reason is that a TagHandler only is
valid during
tree creation.
Doing a post to the same view requests the previously
created tree which
means the
TagHandler won't be called again.
But something is wrong with my understanding of compiletime
and rendertime
because the
TagHandler gets called everytime regardless of a post to the
same view or
requesting a new view.
Having a closer look at the sources i can summarize this to
the following:
"#" is a com.sun.el.ValueExpressionImpl
which holds the
ValueExpresion "myVar".
Additionally a VariableMapper is set which maps as
key<->value the
myVar<->theRandomValue.
The VariableMapper is only used when pushing a Variable into
the context
via faceletcontext.setAttribute(...)
I've found no other cases when the VariableMapper was set.
And now: ValueExpressionImpl externalizes the
VariableMapper.
This means the component which holds the valueexpression
"#" always
associates this binding
with the first resolved value and never resolves that
ValueBinding again.
Is this a desired behaviour?
The problem simply is that my TagHandler prepares a value
which changes
dynamically.
But my components never work with other values than the
initial one
although the TagHandler
pushes the right value with every request into the context.
Does anybody have had the same problem and knows a
workaround?
(Or: is it really neccessary that the VariableMapper must be
externalized?)
thanks
Denny
------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribe facelets.dev.java.net
For additional commands, e-mail: users-help facelets.dev.java.net
------------------------------------------------------------
---------
To unsubscribe, e-mail: users-unsubscribe facelets.dev.java.net
For additional commands, e-mail: users-help facelets.dev.java.net
|