I've got a little problem using tomahawk saveState tag, but I've solved the problem. But I'd like to know some underlying concepts to understand what happened at this situation.
Well, I have the following scenario:
- a managed bean that represents a domain object named (Project).
- a backing bean that represents the view for registering projects named (RegisterProjectMb).
Both beans was defined in my faces-config.xml file.
The RegisterProjectMb has a property project with an instance of Project (injected by JSF managed bean facility).
The Problem: When registering a project the user will be sent to another view to insert more data, so if the user wants to get back to the first page, I'd like that the Project related data can still be presented to the user.
But I don't want to define my Project bean with session scope.
So I use f:saveState as follows:
I've declared the above tag inside my two views: registerProject.xhtml and registerProject2.xhtml, and I was getting an empty project when moving back to the first view.
Solution: After one hour trying to solve this, I declared the saveState to my BackingBean too as follows (and must be declared in the same order as follows):
So, now, my code is working well, but why saving the state of the project or even the registerProjectMb alone does not work?