I am having some trouble with forms inside both forEach and ui:repeat. The action associated with the commandButton does not seem to be invoked at all, the page just refreshes. h:messages is not displaying any messages either.
The code
<c:forEach items="#{newsController.newsList}" var="news" >
<h:form>
<h:inputText value="#{newsController.comment.text}" />
<h:commandButton value="Post comment" action="#{newsController.postComment(news.id)}" />
</h:form>
</c:forEach>
The form is working as expected if i place it outside the forEach or ui:repeat tag.
The postComment method
public String postComment(int newsId){
News news = newsEJB.getById(newsId);
comment.setCreatedAt(new Date());
comment.setNews(news);
commentEJB.persist(comment);
return "news-detail.xhtml?faces-redirect=true&includeViewParams=true";
}