Werner Punz wrote:
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.
Actually, on reflection, I can't really think of a good way to get
everything I want for free anyways. I think I will need to develop a
custom component, probably something that is composed of other existing
UI elements. The three primary use cases I'm looking at currently are a
dynamic, editable table with at least 2 text fields where rows can be
added/removed without the need to roundtrip to the server, an editable,
dynamic table with a drop down list and a text field in a row where rows
can be added/removed without roundtripping and an element where a user
can add multiple file upload elements without having to roundtrip. i
don't really see a way this can all be done in JSF without using custom
elements.
Of course, I'm open to suggestions.
Rich