Primary data ajax Inplace save data

I have one problem with the inplace tag from JSF price lists

Here is a snippet of code

<h:form > <p:inplace id="ajaxInplace" editor="true"> <p:inputText value="#{productService.instance.productName}"required="true" label="text"/> </p:inplace> </h:form> 

after clicking the confirmation button for ajax inplace I want to save the changed data in my database. I have a productService.updateInstance () method to do this. but what can I call this method after making the change?

Thank you and kind

+6
source share
1 answer

Use <p:ajax event="save"

save and cancel two ajax behavior events that you can use to plug in the editing process.

  <p:inplace id="ajaxInplace" editor="true"> <p:ajax event="save" listener="#{productService.handleSave}" update="someThing" /> <p:inputText value="#{productService.instance.productName}" required="true" label="text"/> </p:inplace> 

Where handleSave looks like this

 public void handleSave() { //do something here } 
+8
source

Source: https://habr.com/ru/post/943802/


All Articles