myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig McClanahan" <>
Subject Re: how to detect in the backing bean (the shale viewcontroller) that the user navigates to another page?
Date Fri, 10 Mar 2006 19:46:02 GMT
On 3/10/06, Costa Basil <> wrote:
> Let me give you an example. Let's say I have a table with rows (populated
> from the database) and I have on each row a commandLink to delete that row.
> On the same page I have another commandLink to navigate to another page. If
> I delete the row the table has to be populated as early as possible for the
> deleteRow event to be fired. However, if I navigate to another page I don't
> want to query that table from the database which would happen even if I set
> immediate to true for the commandLink that navigates the other page. Of
> course I have the option of using a hidden link to delete the row but ...

That's a pretty common use case, and here's how I would approach it ...
populate the table in the prerender() method of the view that contains the

This works because, if you actually do navigate to a different page, the
prerender() method of *that* page will be called instead of the prerender()
method of *this* page.  Thus, you will never waste the time to perform the
query (or whatever) to populate the table unless it is actually necessary.


*Costa Basil <>* wrote:
> I use shale and I was wondering if there is there an easy way to know in a
> backing bean on the postback that the user actually pressed a commandLink
> that navigates to another page than the one the backing bean is for. I want
> to avoid unecessary database calls.
> Thanks
> ------------------------------
> Enrich your life at *Yahoo! Canada Finance* <>
> ------------------------------
> Have a question? Yahoo! Canada Answers. Go to *Yahoo! Canada Answers*<>

View raw message