**When the HTML form is submitted it carries the view state value back to the server in the form of an HTTP parameter. JSF uses the value of this parameter to reconstruct the view during the restore view phase. The view is restored by reversing the process used to obtain the view state: it is decoded and deserialized.**
so I have tried to run the following code in jsp page with jsf tags I was able to see the input hidden parameter with facesview state and its value
the encoded html output i was able to view the following hidden value parameter which holds the view state as foolows
but my question is when i have removed the jsf form tag but had some components in the view but there was no hidden element which holds the view state on
client side , so I was wondering how the view state that stores on the client side goes to the server and gets reconstructed i.e the tree of components .It would
be great if someone throws light on the mechanism of how the client-side state saving is done for those components which are valueholders and where is the view root stored on the client??? I would appreciate it if someone can throw more light on this !!!
SCJP 5 || SCWCD 5 || SCDJWS 4 || The Great Sin is to Think Yourself Weak !
Thanks for fixing your display name, Rakesh. Incidentally, I'm not very prompt about answering private emails - sometimes they get delayed a week or more. So when you ask questions on the JavaRanch, not only will others be able to benefit from the question and answer, you'll get a faster response!
An IDE is no substitute for an Intelligent Developer.
Joined: Apr 13, 2009
Thanks Tim for your reply ! so according to your reply it clearly implies that the client side state saving of any single page(view) can be done only if there is compulsorily atleast one <h:form> component in that page ?? So if i dont have form component in my page but even though if i have other components like <h:inputtext> or any jsf component that can hold value and whose state needs to be saved, their state can't be saved on the client side unless I have atleast one form component in the page right ?? So what abut the state saving on server side?? it does not have these limitations right?? It would be great if someone can please let me know about this.... I am really in great confusion.... Thanks once again tim for your reply !
An inputText - or inputAnything, for that matter, is meaningless without a form to contain it. The input controls are all form controls - it's part of their basic definition.
Joined: Apr 13, 2009
Thanks for your reply Tim !... I have one last small question suppose that Iam in PAGE A and when I click on next button I go to PAGE B then how can I access the view root of PAGE A in PAGE B and traverse through the components in PAGE A and access the component values (i.e. state) of PAGE A stored on client side ...It would be great if someone can throw some more light how can i achieve this between requests thereby achieving statefulness of the components between requests.....I would greatly appreciate it if someone can give me a more insight into this.. Thanks Tim for your time and reply....