• Post Reply Bookmark Topic Watch Topic
  • New Topic

To refresh another JSF page on submit from one page

 
Raghu Sundar
Ranch Hand
Posts: 40
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to add records to datatable by submitting a form built using JSF and primefaces which gets popped up from the page containing datatable.On submit of the form the data gets updated to database but i need to refresh/update the datatable with the submitted data.Is there any way using which i can refer the main page on submit from the form so that i can refresh/update the datatable.

JSF code snippet containing datatable




On clicking the command link i get the web page popup through which i can submit the data,the snippet of which is as below




on submit of this form i need the datatable in other page to get updated.


 
K. Tsang
Bartender
Posts: 3610
16
Firefox Browser Java Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you consider using primeface dialog for the form (the one when you click the command link)? That way everything will be on the same page. And also your command button can use the "update" attribute to update the data table.

Another approach is to use a editable datatable such that you click a button and a new row gets added to the datatable directly.

Either way your backing bean's method controls the logic.
 
Tim Holloway
Bartender
Posts: 18414
58
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a user, I find webapps that open multiple pages/tabs extremely irritating. My screen is already crowded enough.

JSF also isn't designed with the idea of running multiple pages at one time, so you can get into a real mess trying to do so.

However, the HTTP/HTML protocols allow a request made on one page to respond on another window by using the "target=" link attribute.

Note that by fundamental definition, one HTTP request can only generate one HTTP response, so it's not possible for a single submit to update 2 different windows at once.
 
Raghu Sundar
Ranch Hand
Posts: 40
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim and Tsang for your suggestion.I will try to achieve the functionality using dialog like the one present in the primefaces showcase.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!