Hi,

I have the typical application where several entities (clients,
invoices, budgets, etc.) can be consulted and CRUD operated. I want to
have a common structure for all of them with:

a) A search criteria form, made of any type of input control (text, combo, etc.)

b) Below, a button to search using the entered criteria by the user.

c) Below, a tabbed panel with several tabs, where the results are
presented in different manners.

Assume my JSF bean is request-scoped (due to session memory
constraints) and it has the model containing the criteria. If I submit
the criteria form using the button (where its immediate property is
set to "false"), the model obviously gets updated in my JSF bean, so:

1) The model gets updated in the Update Model JSF phase.
2) I can use that model from my JSF to invoke my business logic with
the criteria.
3) When the page is rendered again, the results are displayed and also
the criteria, so the user can see what criteria has led to those
results.

But the problem comes when I change from one tab to another. As the
component does neither update the model nor expose the immediate
property:

1) The model doesn't get updated
2) I cannot call pass the criteria to the business logic, so I just
can't find the correct results.
3) When the page is rendered again, the criteria has dissapeared and
obviously the results are not those expected.

So what can I do? There are some possible solutions:

a) Change the JSF bean to session scoped, so the components are not
recreated in each request and are always updated (not through my JSF
bean model, but through the JSF component model itself). I *must*
avoid this solution.

b) Bind a variable in my JSF bean to each input criterion in the
criteria form, as the binding properties get always invoked by the JSF
lifecycle. Then, inside my JSF bean, whenever I need to do the search,
I must get the criteria values from the binded variables.

c) Any more you may propose...

What do you think? How are you facing this functionality in your applications?

Reply via email to