My component is based on this tutorial http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp
Following the ajax patterns, a componente must be updated at server before the data response be returned to ajax request on the browser...
On the page of tutorial, always when a component is rendered on the page, some important values are stored in the session:
http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp#rendering
HashMap bindings =
(HashMap)session.getAttribute("dBindings");
if(bindings == null) {
bindings = new HashMap();
session.setAttribute("dBindings", bindings);
}
...
synchronized(bindings) {
bindings.put(baseId, valueBinding);
}
And before when thge PhaseListener will to response the ajaxRequest, it will update the value on the server, getting from session these values of component.
http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp#phaselistener
It then finds the component ID in the hash map that contains all the component IDs and values and resets its value with the user's input.
ValueExpression valueBinding = (ValueExpression)
((HashMap)sContext.getAttribute("dBindings")).get(compId);
valueBinding.setValue(context.getELContext(), compValue);
The question is:
When these values will be cleaned on the session?
If the componentes will be added dynamically, and these ids created dinamically too, I guess the number of objects in the session will grow fast!
Is correct my thougth?
My custom component will be created many times, on a commercial application, probabily the sessions will be active during a lot of time.
This way to update values on component on server is on blueprints, then it is correct, but I'm not sure about this.
--
----------
Dudu
GoogleTalk: eduardopichler[at]gmail[dot]com
skype:eduardopichler

