问题
I guess I knew the difference, but right now I find myself confused. :P
Both of them seem to be do the same thing, except that partialSubmit
is used on submit buttons to submit the form using AJAX and autoSubmit
is used on editable components, which submits only its own contents. Am I right in saying this?
回答1:
They are both AJAX enabled calls occurring from custom properties of custom JSF components. The autoSubmit
essentially asynchronously postsback content specific to the component for keeping the server side managed bean values current with the content within the component on the client side.
A partialSubmit
is another asynchronous AJAX call that will serve to immediately postback a component value on some kind of component event, like losing focus on an ICEFaces inputText component for example.
The interesting thing to note is that the entire ViewState is posted back on each type of asynchronous submit, so if the values of other components HAD changed on the page before the submit, the bound server side managed bean properties will have their values refreshed as well, even though the client side components MAY not be refreshed to reflect any server side data changes that may have occurred.
In fact, the entire JSF server side lifecycle occurs on each postback, read the following article on implementing a debug PhaseListener that allows you to see what Phases are occurring after each asynchronous submit operation occurs.
http://balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html
回答2:
The accepted answer isn't 100% correct for ADF. The partialTriggers
attribute is involved in the lifecycle.
From Enabling Partial Page Rendering Declaratively
The
autoSubmit
attribute on an input component and thepartialSubmit
attribute on a command component are not the same thing. WhenpartialSubmit
is set to true, then only the components that have values for theirpartialTriggers
attribute will be processed through the lifecycle. TheautoSubmit
attribute is used by input and select components to tell the framework to automatically do a form submit whenever the value changes. However, when a form is submitted and theautoSubmit
attribute is set to true, a valueChangeEvent event is invoked, and the lifecycle runs only on the components marked as root components for that event, and their children. For more information, see Section 4.4, "Using the Optimized Lifecycle".
来源:https://stackoverflow.com/questions/7281379/what-is-the-difference-between-partialsubmit-and-autosubmit-in-jsf