aspose file tools
The moose likes JSF and the fly likes JSF Tomahawk - t:saveState Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "JSF Tomahawk - t:saveState" Watch "JSF Tomahawk - t:saveState" New topic
Author

JSF Tomahawk - t:saveState

Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 142

Hello all.

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?

Could anyone help me to understand it?

Thanks in advance.


Adolfo Eloy
Software Developer
OCPJP 6
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JSF Tomahawk - t:saveState
 
Similar Threads
JSF Request Processing Lifecycle Basics
An important question about the use of STATIC in JSF
"#{...} is not allowed in template text" error
JSF backingbean value is null always.
Displaying simple read-only tabular data