It's an output only list of elements, so the notion of validation there
is pointless. All i needed is a link that call an action with an id
parameter. That's why i didn't understand why there was in that case a
need for no model change. My call does set nothing except a parameter,
which according to a sniff of protocol is present in the request and so
does not need the datatable for evaluation. There was no need to rebuild
datatable to handle this command, but it seems it's needed whatever. So
i need to always reset data, validation errors or notn action or simple
refresh from browser. (i need to create a clickable "always up to date"
list of items on the left)
So in my case i need to update it, even if the action wasn't successfull
:) The user naturally except the list to be up to date, at least for the
first 3 seconds after the server sent him the page :)
thanks for your help :)
Mike Kienenberger a écrit :
> David,
>
> The place where it no longer matters is pre-renderResponse (but see
> below).
>
> If you want to plug in something independent of how you got there,
> define a pre-renderResponse phase listener.
>
> HOWEVER, the model really shouldn't be changing if there were
> validation errors on the page, because resubmitting the page should
> continue to work off the original table model. In my opinion, the
> only reasonable place to update your model is when you've successfully
> executed an action.
>
> On 9/19/06, delbd <[EMAIL PROTECTED]> wrote:
>> Yes, but am not very advanced in jsf life cycle and such things. I
>> understood there a web page is a snapshot, but i wonder how to update
>> model if you have to constatly keep in ,ind that in fact your model must
>> not change? How do i plug something in somewhere to have make this
>> refresh at a moment that won't alter the behaviour of datatable?
>> Mike Kienenberger a écrit :
>> > A datatable's model is not the same as the database state.
>> >
>> > The model needs to remain constant from one renderResponse to the next
>> > invokeAction. If the rows don't match between the two requests, then
>> > it's meaningless to have any UICommand or UIInput components in the
>> > dataTable since there's no way to get from the generated-html "view"
>> > of the data from the previous request to the backing objects that
>> > created that view.
>> >
>> > It's up to your application to determine if the database still matches
>> > the model when parsing the next requests. And after handling that,
>> > right before every renderResponse, you should feel free to refetch the
>> > database state into the model so it's up-to-date again.
>> >
>> > A database changes constantly. But web pages are snapshots at
>> > discrete intervals into that database.
>> >
>> >
>> > On 9/18/06, delbd <[EMAIL PROTECTED]> wrote:
>> >> It's a database, values always change and not only during an action.
>> >> That's why i am using request scope bean for those values, which
>> brings
>> >> me troubles when it comes to needing a permanent state for
>> datatable to
>> >> work properly...
>> >>
>> >> Mike Kienenberger a écrit :
>> >> > You only need to reset the bean values if the bean values change in
>> >> > some way beyond the normal flow of the program. Ie, if you
>> click on
>> >> > a button, and suddenly a row is gone, then you need to reset your
>> >> > cached/saveState'd backing list.
>> >> >
>> >> > If you have a specific example, I can offer you some specific
>> advice.
>> >> >
>> >> > On 9/18/06, David Delbecq <[EMAIL PROTECTED]> wrote:
>> >> >> Ok, In this case that can be applied because this action is the
>> >> only one
>> >> >> involved in that specific form. But what about more complex form,
>> >> where
>> >> >> there is such a table but lots of possible actions, if i need to
>> >> always
>> >> >> reset the bean value between the decode and the encode operations?
>> >> >> Mike Kienenberger a écrit :
>> >> >> > Yes to both of you. All you need to do is update your backing
>> >> data
>> >> >> > model in the action -- pretty convenient :-)
>> >> >> >
>> >> >> > Ie, if you have something like
>> >> >> >
>> >> >> > <h:dataTable value="#{sharkEngine.acceptedAssignments}"
>> >> >> > <h:commandLink action="#{sharkEngine.action.showActivity}"
>> >> >> >
>> >> >> > then in #{sharkEngine.action.showActivity} you change the
>> value of
>> >> >> > sharkEngine.acceptedAssignments to be the updated list.
>> >> >> >
>> >> >> >
>> >> >> > On 9/16/06, delbd <[EMAIL PROTECTED]> wrote:
>> >> >> >> So then my problem is how to have the datatable contains old
>> datas
>> >> >> >> before action and new datas after action...
>> >> >> >
>> >> >> > On 9/16/06, Mr Arvind Pandey <[EMAIL PROTECTED]> wrote:
>> >> >> >> u r right. u can use preserveDataModel="true" in
>> >> >> >> datatable. if it is true then action method surely be
>> >> >> >> invoked. But the problem is if u want to delete the
>> >> >> >> row from table and afetr deletion you want to display
>> >> >> >> the same page then row will be deleted from DB but
>> >> >> >> page will contain that row. I am looking for the soln.
>> >> >> >
>> >> >> >> Mike Kienenberger a écrit :
>> >> >> >> > h:dataTable value="#{sharkEngine.acceptedAssignments}" must
>> >> remain
>> >> >> >> > constant from renderResponse of the first request through
>> >> >> >> > invokeAction of the second request.
>> >> >> >> >
>> >> >> >> > I handle this by using <t:saveState
>> >> >> >> > value="#{sharkEngine.acceptedAssignments}">
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > On 9/15/06, David Delbecq <[EMAIL PROTECTED]> wrote:
>> >> >> >> >> Hello,
>> >> >> >> >>
>> >> >> >> >> I have a datatable that iterate over some database values.
>> >> Those
>> >> >> >> values
>> >> >> >> >> are subject to change, especially in quantity. The
>> datatable is
>> >> >> >> rendered
>> >> >> >> >> like this:
>> >> >> >> >> <h:dataTable value="#{sharkEngine.acceptedAssignments}"
>> >> >> >> >> var="theAssignment">
>> >> >> >> >> <h:column>
>> >> >> >> >> <h:commandLink immediate="true"
>> >> >> >> >> value="#{theAssignment.activity.name}"
>> >> >> >> >> action="#{sharkEngine.action.showActivity}"
>> >> >> >> >> actionListener="#{sharkEngine.action.commandListener}">
>> >> >> >> >> <f:param name="activityToShow"
>> >> >> >> >> value="#{theAssignment.activity.key}" />
>> >> >> >> >> </h:commandLink>
>> >> >> >> >> </h:column>
>> >> >> >> >> </h:dataTable>
>> >> >> >> >>
>> >> >> >> >> This basically renders a list of links that need to
>> contain one
>> >> >> >> >> information: "activityToShow". Technically,
>> >> >> >> >> #{sharkEngine.action.showActivity} will need nothing more to
>> >> setup
>> >> >> >> >> session and show the edition form. However, between
>> display of
>> >> >> >> table and
>> >> >> >> >> click by user, the database list referenced by datatable is
>> >> >> >> subject to
>> >> >> >> >> change (because whatever happens, we must reflect db
>> >> changes to
>> >> >> >> user).
>> >> >> >> >>
>> >> >> >> >> Here is the problem:
>> >> >> >> >> If 3 items are showned to user (let's say a,b,c), the user
>> >> clicks
>> >> >> >> on the
>> >> >> >> >> last one (c) but by that time the entry a has been
>> removed from
>> >> >> >> >> database, the action does not take place?!?
>> >> >> >> >> I suspect this is because the 3rd line of datatable has
>> been
>> >> >> >> removed,
>> >> >> >> >> but how do i handle this. The user won't accept that nothing
>> >> >> happens
>> >> >> >> >> while he clicks on an entry, obviously. JSF is silent on
>> why it
>> >> >> >> did not
>> >> >> >> >> execute the action and <h:messages/> shows nothing too.
>> >> >> >> >>
>> >> >> >> >> What is the good way to create such list of links?
>> >> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>>
>>