NotGrm
NotGrm

Reputation: 111

JSF : Passing data between 2 views

I'm a french computer science student, and I have a small JSF project for school. I'm a little bit noob and I try to pass data between 2 view but I fail.

First I have a view which list all my customers, in a datatable. In this datatable I have a link to show a customer profile. I use, for both view, a CustomerController which is a requestscoped managedbean.

Before I use a global sessionscoped controller but I think it's not the good way to pass data.

Then I found this article : JSF Best Practices, it recommend to use to pass object between views. I didn't manage to make it work.

And finally I found also this question from Stackoverflow : f:setPropertyActionListener sets null value instead of intended value which use

My question is : what is the best ways to pass data ? And how manage it ?

Upvotes: 1

Views: 8929

Answers (1)

Petr Mensik
Petr Mensik

Reputation: 27526

It's explained in this article from BalusC. You need to send id of your selected item to second view through h:link and catch it then with <f:event>.

Upvotes: 5

Related Questions