This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

refresh data in session jsf2, primeface

 
doinigly jaquel
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two xhtml pages : the first allow to store new order, the second allow to list all of orders stored in the database.

For specific purposes, I have sessionManeged in the second page and the problem is when I save a new order and I go in the second page it doesn't get refresh because data are stored in sessions.

Can you suggest me a method to refresh data (re_run query to database) when a new order is stored?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17995
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The standard JSF navigation mechanism is designed to do that. Inject the backing bean for the second page into the backing bean for the first page as a Managed Property.

When the action method for the first page is invoked in the backing bean for the first page, have that backing bean invoke a setup method in the second bean. That setup method can then fetch the data.

When the action method returns to the JSF Controller with the navigation rule, the second page will be displayed and its backing bean will contain the desired values.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic