Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF session scope beans with Tabbed browsing

We have the following problem...

Application's environment:

JSF, Richfaces, a4J

Consider having the following scenario:

  • The user logs into the system
  • The user navigates to a new page which consists of an a4j form containing a4j components, the user fills into the form but doesn't submit.
  • The user opens a new Tab and opens the same URL and fill in the new form with new data
  • The user returns to his first Tab and submits the information (Note: All beans are defined are session scope)

Result:

The submitted information is the information from the second Tab but submitted from the first Tab, which is expected as long as the beans are defined as session scope.

Problem:

We need to get the behavior of a request scope (i.e: dealing with new tab as a new request although the bean is defined as a session scope).

Notes:

When defining the bean scope as a request scope the partial Ajax response from individual components in the same form, resets the other components since they are not submitted yet.

Any suggestions ?

--

Thanks so much

like image 948
Ahmed Mounir Avatar asked Dec 20 '25 09:12

Ahmed Mounir


1 Answers

This is a well known problem for Web applications.

Of course you can try to solve this problem using more custom code but my quick suggestion is to use the seam framework which solves exactly this.

Seam is a superset of JSF and introduces a new conversation scope for beans that does exactly what you want.

Seam supports richfaces natively (both are projects of JBoss/Redhat) so you should not expect any problems with integration.

like image 146
kazanaki Avatar answered Dec 23 '25 06:12

kazanaki



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!