It's not a secret anymore!
The moose likes JSF and the fly likes JSF Tomahawk - t:saveState Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF Tomahawk - t:saveState" Watch "JSF Tomahawk - t:saveState" New topic

JSF Tomahawk - t:saveState

Adolfo Eloy
Ranch Hand

Joined: Mar 21, 2009
Posts: 146

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.

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
I agree. Here's the link:
subject: JSF Tomahawk - t:saveState
It's not a secret anymore!