问题
I did some research on JSF view instances: new view, initial view, and postback view. But, I am still not quite sure about the differences. It's kind of confusing and I haven't been able to find a good explanation on that. Can somebody put some light on this one?
回答1:
That was how JSF 1.0/1.1 works. They are explained in detail in this ancient IBM article. But you should forget and ignore the whole article (see also "Editor's notes" section on top which was edited in afterwards). It does not apply anymore since JSF 1.2 and newer (including JSF 2.x). There is only "initial view" and "postback view". The "new view" does not exist anymore.
An initial view is been created upon a GET request and an existing view is been reused upon a POST request. When a GET request results in a response with a <h:form>
for POST, then the (partial) view is referenced by a hidden input field with name javax.faces.ViewState
. This very same same view will be restored and used to process the form submit (the postback).
来源:https://stackoverflow.com/questions/5912534/difference-between-jsf-view-instances-new-view-initial-view-and-postback-view