Richard Wallace wrote:
Werner Punz wrote:
Richard Wallace wrote:
Ok, but how should I "tinker" with the element tree? I'm guessing
AJAX will need to come into play. But how do I get access to the
element tree? And exactly how should I manipulate it? I'm guessing
there's no ready to go methods already in the JSF APIs to accomplish
this, are there?
I think you have a small misunderstanding here what JSF is and what
you can do.
I completely understand that.
You cannot alter the backend element tree without any refresh, so you
have to force a refresh to do that in the backend.
That's why I was wondering if AJAX could be used when a new form element
is being created to modify the backend element tree without having to
refresh the whole page.
Ok a misunderstanding from my part, to my knowlege, you cannot really do
that, because the element tree is rebuilt at each subsequent request.
The safest bet is to stay on the ajax/client side only for what you want
to achieve, and once you hit a refresh, fetch the ajaxed part directly
from the request object if you need to do further processing on it.
What you also could do is to componentize the ajaxed part of your form,
that way you could establish a connection between the element tree and
your ajaxed part of your form.
Then the flow would look like that...
pure client side... do anything with the ajax elements
submit or something else which causes a refresh:
the value binding and binding mechanisms transfers the values from the
ajaxed components to the backend beans for further processing.
The third way could be to have the form parameters parsed at request
level and then the component subtree rebuilt at the subsequent refresh.
But that approach is probably the messiest of all three.