0

This is more kind of theoretical question with pragmatic implications.

I have a page in which users can search for people. As a result of the search , there will be a list of people which meet the search criteria. Alongside every record(every person) There will be a link that takes the user to another page with more details about the person the user wants to know more about.

So far so good. My dilemma It is that in real world situations users might want to check several persons at the same time. I am not sure how to implementing without using JSF Request Beans. The situations is like this:

  1. User clicks (actually right-click "Open link in another tab" ) to see the details of a person 1
  2. Users clicks to see the details of another person 2.
  3. User do changes on person 1
  4. User do changes on person 2.
  5. User go back to person1-detail page and do changes again

Is it possible to implement the page with person Details supported in ViewScoped Beans ? If so, should the request that navigates from the search result page to the detail-person page be a post-request ? Any other workarounds ? Flash-Scoped ? COnversations ?

kolossus
  • 20,559
  • 3
  • 52
  • 104
Deibys
  • 619
  • 3
  • 9
  • 18

1 Answers1

0

Keep the list in @ViewScoped make the persons clickable and use a nice overlay component to show the details if they click the link. PrimeFaces, the most popular framework should have several options for this as do the other ones. Include a button / link for opening with target = _blank if your users like to roll like that.

the bean backing the new window with details could be @RequestScoped and use injection to get the correct person instance. This of course requires that you save what was clicked ie Person selectedPerson; or you could append the index to that person as a request param and use getPersons.get(selectedPerson);

If you go for the second solution you might want to check out What can <f:metadata>, <f:viewParam> and <f:viewAction> be used for?`

Also, consider using CDI. The forth release from Deltaspike that is up and coming very soon will offer several great scopes. For example if you want to track seperate state in each of those new windows @WindowScoped could be nice.

Good luck

Community
  • 1
  • 1
Karl Kildén
  • 2,415
  • 22
  • 34
  • Thanks a lot for the response. Your last paragraph is exactly what I am needing . I want to keep different states of a same view without using RequestBean. Could I use ViewScope or FlashScope ? – Deibys May 16 '13 at 22:45
  • What's wrong with RequestScoped beans? Those are the best beans. If you like the answer consider accepting it and / or voting it up – Karl Kildén May 17 '13 at 07:52