0

I am working on JSF. I have an xhtml page with multiple forms. when i am submitting one form, and if i had made some changes on other form i am loosing it, as on submit the page is getting refreshed. I cannot use a single form. is there any way to do.

any solution will be highly appreciated.

thanks !

user1394523
  • 161
  • 1
  • 2
  • 7

1 Answers1

1

If you're already using JSF 2.x (your statement that you're using XHTML (Facelets) confirms this less or more), just submit the form by ajax.

It's a matter of adding the following tag to the command links/buttons of the form:

<f:ajax execute="@form" render="@form" />

This way the current <h:form> will be submitted by ajax and the current <h:form> only will be rendered (updated/refreshed). You can if necessary specify other to-be-updated components in the render attribute by adding other client ID(s).

If you're still on the old JSF 1.x, you may want to look at Ajax4jsf sublibrary of RichFaces which supports basically the same.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555