aspose file tools*
The moose likes JSF and the fly likes JSF client side state saving Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF client side state saving" Watch "JSF client side state saving" New topic
Author

JSF client side state saving

rakesh kandula
Greenhorn

Joined: Apr 13, 2009
Posts: 4
I know the following thing

**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 !
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2713
    
    5

"rockynirvana nirvana " welcome to Javaranch
please check your private messages for an important administrative matter. You can check them by clicking the My Private Messages link above.


SCJP, SCWCD.
|Asking Good Questions|
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15662
    
  15

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!

I'm not quite sure what you have in mind here, but in order for a standard (non-JavaScripted) HTML page to get data POST'ed back to the server, that data has to be inside an HTML form. more precisely, it has to be the same form that the SUBMIT button fired from, if you have multiple forms on a page.

The basic JSF system (when using the default rendering) is built on HTML without JavaScript, so it's subject to the same limitations. There has to be an HTML form to hold all the state-related information. Hope that helps.


Customer surveys are for companies who didn't pay proper attention to begin with.
rakesh kandula
Greenhorn

Joined: Apr 13, 2009
Posts: 4
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 !
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15662
    
  15

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.
rakesh kandula
Greenhorn

Joined: Apr 13, 2009
Posts: 4
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....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF client side state saving
 
Similar Threads
Navigation problem
input type="hidden" value="....a chain of rubbish letter..."!!
Incorrect state saving of the part of the view ?
Duplicate Component ID found in view
Multiple forms and duplicate javax.faces.ViewState ids