How to add rows to a UIData datable without persisting to the DAO?

Here's a brain-twister. I'm using JSF for the following:

I have a "main" page that lists Tasks. The user is able to click on a task to navigate to a Task Editor page, where they can edit information. Each Task has a list of Task Administrator emails, and the Task Editor page displays them in an h:dataTable.

What I'd like to be able to do is allow the user to click on an "Add" link to create new entries to the Task Administrators dataTable, but not save this information to the database until they click the "save" button. If I keep the Task Editor page's backing bean in the session scope, this is trivial, but if I do that, then the bean is not re-initialized when the user selects a different Task from the main page (since intialization occurs in the constructor of the Task Editor's backing bean). If I keep the backing bean in the request scope, then it's re-initialized every time Faces instantiates it, which basically clears out the admin emails table and reloads it from the database.

How can I go about allowing the user to add items to the emails dataTable?

[1103 byte] By [xoxotaa] at [2007-11-27 11:26:53]
# 1

It's as simple as you said: just do not persist the data until the user presses the 'Save' button?

BalusCa at 2007-7-29 16:13:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

Right, but then the bean is destroyed and re-created on every post-back. Since it's in the request scope, instantiation re-initializes it from the database, which basically removes all the newly added items.

xoxotaa at 2007-7-29 16:13:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Then just store the data in session? Create a session scoped bean for the data and a request scoped bean for the views and the actions.

BalusCa at 2007-7-29 16:13:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Right, but since the data Bean is initialized in the constructor (the first time it's referred to from my JSP page), it'll only ever get initialized once. So next time I click on a Task to edit it, I'll see the editor page containing the information for the first Task I clicked on, and not the current Task.

xoxotaa at 2007-7-29 16:13:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5

Split your code into two beans; one that is session scoped that tracks the added data and one that is not that gets re-initialized as desired.

RaymondDeCampoa at 2007-7-29 16:13:07 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...