views:

43

answers:

1

I am not sure if what I want is possible, but it worth a try to ask. Let say, I have 2 pages: List.jsf and CreateNew.jsf. List.jsf display data from datasource as <p:dataTable>. CreateNew.jsf insert a new entry into the datasource. What I want is from CreateNew.jsf, when I click create, it create a new entry in a database, then return back to List.jsf, but at this point List.jsf somehow refresh itself so that new entry will be displayed as well. Is it possible to achieve it? Couples thing worth to note: Managed bean for List.jsf is SessionScoped and the managed bean for CreateNew.jsf is RequestScoped

Navigation flow in handle inside faces-config.xml.

+1  A: 

Either change the @SessionScoped bean associated with List.jsf to be @ViewScoped so that a new one is constructed, or add a method like reloadList() to the @SessionScoped bean, inject that as @ManagedProperty into the @RequestScoped bean and let it call that method after creating the new entry.

BalusC
Beautiful. Thank you :D I know the solution about switch to `ViewScoped`, just want to be a bit fancier. But create `reloadList()` is definitely a way to go. TY
Harry Pham