开发者

JSF2: navigation flow question

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开发者_JAVA技巧.jsf is RequestScoped

Navigation flow in handle inside faces-config.xml.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜