-
1. Issue when submitting after AJAX call
ilya40umov Feb 2, 2011 1:33 PM (in response to sudda_1)1) h:commandLink should not be inside rich:dataTable
2) I think that actionListener="dataBean.saveData" should look like actionListener="#{dataBean.saveData}"
3) You have a requestScope bean and JSF is not supposed to create your objects in list. It just can execute setters for some fields but not a setter for List. That's why you should use a4j:keepAlive tag to keep your bean alive until user is working with the current page. (Or you can put your bean into sessionScope)
-
2. Issue when submitting after AJAX call
sudda_1 Feb 2, 2011 2:09 PM (in response to ilya40umov)Points 1 & 2 are valid. They were typo and cut&past errors when I was posting question.
Point 3 is not very clear regarding JSF not supposed to create objects in list. I found that JSF does know to update items in list in following scenario.
1. Initialize List in bean constructor (or @PostConstruct init() method).
2. Use the list in <rich:dataTable > component
3. Update values on dataTable
4. Submit Form
Changes made are updated on List items on the server correctly.
It's only when some AJAX initiated updates are done on table that they don't get posted.
So I want to confirm that any AJAX created elements on page(e.g new row in table) does not get set when submitting page.
-
3. Issue when submitting after AJAX call
ilya40umov Feb 2, 2011 2:22 PM (in response to sudda_1)These elements are getting set but if you have requestScope bean it means that they will dissapper just after the ajax call is finished. To save state of bean you should use the options I mentioned.
Scenario:
- rendering page
- ajax call add elements to list
- BREAK POINT 1
- ajax/non ajax call to set values of objects in list (for insatance object n1,n2,n3 set field x to 'a1','a2','a3')
- BREAK POINT 2
So in case of requestScope bean:
BREAK POINT 1 : list is cleared
BREAK POINT 2 : jsf can't find these objects n1,n2,n3
in case of pageScope or sessionScope bean everything works ok.
-
4. Issue when submitting after AJAX call
sudda_1 Feb 2, 2011 3:04 PM (in response to ilya40umov)Thank you for the clear explanation.