Title: Message
Yes, you've mentioned that before.  I realize splitting the classes doesn't address the problem.  However, it serves to clear one's thinking, which is at the root of the problem many people are having with it, IMO.  If Rick just calls his bean to get a refreshed set of values, those values should show up on the screen, which was his basic question.
 
- Brendan
-----Original Message-----
From: ir. ing. Jan Dockx [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 01, 2005 2:53 PM
To: MyFaces Discussion
Subject: Re: more on architecture really confused on something (shocker:)

There is no meaningful difference I can see between your approach and Rick's. Splitting the "handler" or "backing bean" in 2 just moves the problem, but it doesn't solve it.

The main issue is, and Rick is absolutely right, that dataTable works on the basis of the index of the row a user clicked on. To be sure you have the right data, you need to keep the data model, with the data, in the order, as it was displayed, across to the next HTTP request/response cycle. A benefit of JSF dataTables is the possibility of edit-in-grid. When you don't store the data across requests, there is even the possibility that, on submit, data filled out in a row for one record, is actually stored in another (e.g., when a record was removed or added before the edited record in the current sort order).
This IS ludicrous, especially for large data collections.

We just have to admit that dataTable, like other components, is only applicable to small data collections. What we need is a data-table-like component that works position independent. Let's face it: we are talking DB app's here, and those records have a primary key. That's what we need to recognize on which row the user clicked, not a position. Someday, we will have that.

On 1 Sep 2005, at 21:39, CONNER, BRENDAN (SBCSI) wrote:

Are you trying to do everything in EmployeeListBean, or do you have an
EmployeeListAction class to handle actions (e.g., looking up an
employee's information, processing "Save") separate from the data? If
you have a separate EmployeeListAction bean that has a managed property
reference to EmployeeListBean, then, when the Action is called with the
"Save", it can invoke a method on the EmployeeListBean to reset its
data, passing the new list of data as an argument.

That's the approach we follow, anyway.

- Brendan

-----Original Message-----
From: Rick Reumann [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 01, 2005 1:53 PM
To: MyFaces Discussion
Subject: more on architecture really confused on something (shocker:)


Ok, I have a bean that needs to populate a table so I was trying to
work with ListDataModel and I can get it to work fine but where I'm
running into 'best practice' difficulties is after doing an update to
an item in the table, I want a fresh population of the ListDataModel
to be used on the resulting JSP.

Here's the problem...

Say I have in my EmployeeListBean ...

private static ListDataModel model = new ListDataModel(
EmployeeService.getEmployees() );

public ListDataModel getEmployeesModel() {
return model;
}

I can use this on a jsp like...

<h:dataTable var="emp" value="#{employeesListBean.employeesModel}" >


However, now I click on a link to edit a row in the table and I pull
the row in a resulting action...

employee =
(EmployeeVO)getEmployeesListBean().getEmployeesModel().getRowData();

I then edit this employee on a resulting editForm and then when I
submit that form, I want to repopulate the ListDataMode from the
database.

I could just add a method to the EmployeeListBean...

public void populateListDataModel() {
model = EmployeeService.getEmployees();
}

and I can call that after I do an update. The problem is I think this
is a really ugly solution. After doing an upate I shouldn't have to
remember to populate some other dataModel in some other class. The
EmployeeListBean should be able to stand by itself.

Ideally when I do...

<h:dataTable var="emp" value="#{employeesListBean.employeesModel}" >

I want a FRESH list of the employeesModel coming from my Service class
(backend call to populate the list),

If I alter the method getEmployeesModel() to look like:

public ListDataModel getEmployeesModel() {
model = EmployeeService.getEmployees();
}

that'll work fine for the list population on the JSP, but I'll of
course still need a method to get back the actually model that is on
the JSP for when I click on the row and need to get that actual model
that has the row I selected?

How do I set this object up so that I have a method that populates a
fresh list on my JSP and also has a handle to get the listModel so
that I can call it and get the rowData I need?


Met vriendelijke groeten,

Jan Dockx

PeopleWare NV - Head Office
Cdt.Weynsstraat 85
B-2660 Hoboken
Tel: +32 3 448.33.38
Fax: +32 3 448.32.66

PeopleWare NV - Branch Office Geel
Kleinhoefstraat 5
B-2440 Geel
Tel: +32 14 57.00.90
Fax: +32 14 58.13.25

http://www.peopleware.be/
http://www.mobileware.be/

Reply via email to