This question probably does not fit SO rules, but I'll ask it anyway. Answers might help other people struggling with JSF.
We are using JSF (MyFaces, PrettyFaces, PrimeFaces and Spring) on one of our biggest project for two years now (migrated from Tapestry 3). I can say that we are "recovering" from this migration to this day.
In my opinion one of our major mistakes was misunderstanding of JSF's VIEW SCOPE. JSF offers two basic mechanisms how you can persist VIEW STATE - CLIENT and SERVER. We went for the SERVER method, which was our first mistake as ViewExpiredException
never stopped coming from that moment on. The next mistake was to store data on VIEW SCOPE as that prevented us from easily switching to CLIENT state saving method.
So I was thinking whether there are some best practices and guidelines on what should and shouldn't be stored on VIEW SCOPE (and thus serialized into VIEW STATE). Official documentation and specification does not provide that. But I came to a quite nice conclusion:
- You should only store on VIEW SCOPE such information that you would normally (without JSF) pass as request parameters.
When you have a basic CRUD application without JSF, you would do this:
- state of the form is preserved between requests by form values in POST parameters
- state of the list (filtering, sorting, paging) is preserved between requests by query parameters
Is my conclusion correct? Do you have any other guidelines on what to store and what to never store inside VIEW SCOPE? Do any component frameworks have such guidelines?