Out of curiosity, are you setting javax.faces.STATE_SAVING_METHOD to
client in your web.xml? If not, can you try doing that and seeing if
you observe the same behavior?
- Brendan
-----Original Message-----
From: Kevin Galligan [mailto:[EMAIL PROTECTED]
Sent: Monday, August 29, 2005 2:50 PM
To: users@myfaces.apache.org
Subject: Re: Concerning DataModel usage plus overhead?
I tried to send this, and I think it failed. Anyway...
Rick, "To me the above is just really goofy. Unless, there are security
constraints to me it makes sense to get the item you want back based on
some key."
You and I are on the same page. I'm not sure I'd so far as goofy, but I
think for particular domains, the DataModel pattern isn't really the way
to go.
Brendan "It's just that JSF offers the DataModel abstraction such that,
when the user clicks on your link, your program just has to ask
DataModel for rowIndex to locate the row that was selected. *It's
designed to simplify your coding.*"
If you look through the post I pasted in my message, I had a fairly
serious problem with the DataModel. I was using it to show a list of
entries from a database. When the user visits the page, it grabs the
list from the database and displays it. I was able to take the example
from the O'Reilly book and break it. How? Basically...
1) Get the list of entries on one browser screen
2) Open a different browser and add an entry
3) Go back to the original browser and click an entry
If you do it in the "magic" order, you'll wind up selecting a different
row than you clicked on. This is because the DataModel uses a numerical
index instead of a internally meaningful id value.
If you use the extended dataTable and the forceIdIndexFormula, you can
index by an id value, but its still doing some strange dynamics. I'm
guessing, but I think when the user clicks, the system would have to get
the full list again, scan through it, and then select the value you
want. Its self-consistant in that it'll select the correct entry, and
maybe its conceptually simpler, but at the expense of significant
processing and data access.
In the post I asked if anybody used more of a hybrid approach. Do your
lists with "classic" link-by-id design, grab the singular value, and
pass to a jsf page. I also had some thoughts on implementing this
directly in JSF, but in a way that avoided double data grabs or
link-by-index designs.
Ok, back to my reguarl day job...
(thanks in advance, again)
CONNER, BRENDAN (SBCSI) wrote:
Yes, you could do your own parameter passing. It's just that JSF
offers
the DataModel abstraction such that, when the user clicks on your
link,
your program just has to ask DataModel for rowIndex to locate the row
that was selected. It's designed to simplify your coding.
In the applications I've worked on, we very rarely have to explicitly
pass request parameters. Pretty much everything is in the bean.
- Brendan
-----Original Message-----
*From:* Rick Reumann [mailto:[EMAIL PROTECTED]
*Sent:* Monday, August 29, 2005 2:09 PM
*To:* MyFaces Discussion
*Subject:* Re: Concerning DataModel usage plus overhead?
On 8/29/05, *Kevin Galligan* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
If you use the standard dataTable, you have to
keep your values in session between the time you show the list
and when
they click on the value. If you get the values from the db
each
time,
you open the possibility that the index will have changed, and
the
selected value will be incorrect. If you keep the values in
session,
its keeping a lot of data around, and you need to explicitly
code a refresh.
To me the above is just really goofy. Unless, there are security
constraints to me it makes sense to get the item you want back
based
on some key. Maybe for example you are looking at a list of care
models on a page, then you want to see the details of the car. It
makes most sense to me to click on the car model passing the id of
the model you want, you look up the model and you pass it back.
When
you need the list of cars back, get a fresh set from the backend.
If
you need caching, cache at the persistence layer.
I don't see the advantage of saving the state of a DataModel, but
I'm new to all of this, so maybe I'll see the light at some point.
--
Rick