Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

f:ajax not working inside c:forEach

 
Ifta Khirul
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to use f:ajax inside c:forEach Tag. But it is not working .



How can I make it workable ? If i place the h:inputText outside c:forEach then it works perfectly.
But my textbox are dynamic and they will be generated inside the c:forEach tag block.

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a general rule, you should shun JSTL in JSF View definitions. They cause many problems and there are ways to do the same thing in native JSF with less trouble.

When attempting to present a collection of objects in a JSF View, I recommand that you first consider using the h:dataTable tag. For cases where the tabular layout that dataTable provides isn't suitable, the fallback would be the ui:repeat JSF tag.
 
Ifta Khirul
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks for your reply.

I have removed c:forEach and used ui:repeat but still it is not working.



after rendering the view completely if i take the code of the component using firebug or view source - then i get the following code



that means it generated the onkeyup events but it is not executing the backend method.

Any clue ?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a backing method won't fire, it's one of the following:

1. The control(s) are not contained in an h:form (yours is, according to your source HTML)

2. Values in one or more of the form controls are invalid (h:messages element will display validation errors)

3. The name of the bean or method is misspelled or miscapitalized (if the method cannot be located, it isn't called and no error is generated).
3a. Same thing applies to the View attribute name (action=, listener= or whatever) that binds the method to the view.

4. The signature of the method is incorrect. In the case of an AJAX action, it should either be "public void saveFactValue()" or "public void saveFactValue(AjaxListenerEvent event)". Or whatever "AjaxListenerEvent" is actually called. I don't remember.
 
Ifta Khirul
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understood the case. But in the current scenario the backend bean method is being called when the textbox is outside ui:repeat tag. Which means that the backend bean configuration are ok.
Anyway thanks for your quick and helpful responses. I will try to investigate more.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic