I already wrote about the fileupload via ajax, and again, I have to warn, if you use that stuff you are bound to MyFaces.
But nevertheless, partial page submit and queue control are two important features which have been enabled since 2.0.1:
Queue Control, what is it?The official spec enforces following behavior: if you submit an Ajax post it is either sent directly if no other submit is running or enqueued until the running ajax submit has terminated and then the submit is issued.
Now this causes following problems
Here typing happens on the fly and a load of submits are issued, they are either queued or simply sent to the server causing constant loads.
Here a request hangs for a longer period of time, filling the client queue.
For those two szenarios we introduced (thanks to the j4fryguys Ganesh and Alax who donated the code), advanced queue control.
Here is the deal on how to use it (and again the obligatory you bind yourself to myfaces warning)
First a short introduction to our configuration system: We are very modular all layers are bound late via configuration and also vital parts of the system can be replaced without digging into the code internals that way, this configuration system also can be used to override certain default behavior.
Now there are to ways to override the configuration, you can do it globally under the myfaces.config namespace or locally by pushing another additional set of parameters in the options map under myfaces (example below)
An example for a global configuration for instance is:
an example for a local configuration override for a single request is:
Now we have following possibilities in our codebase:
For a typical ajax scenario following might be a viable approach:
Second Part, PPS
This solves following scenario, per spec definition the entire form passed down must be submitted at each Ajax scenario. Often this is unnecessary, especially if you only execute parts of the subtree. Unnecessary data is passed down and if you have something like a textfield in the form then it is even heavy on the server.
There pps helps. With pps you will just pass what is needed to be executed, you also can put the execute on a parent node and it determines which childs have to be passed down the execution chain and it only submits the parameters it really needs to pass down.
(note this does not work in the ajax fileupload case)
Here is an example on how to use it:
again this also can be set globally via
myfaces.config.pps = true