myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Andraschko <andraschko.tho...@gmail.com>
Subject Re: ui repeat fails to reflect collection after render
Date Thu, 25 Jan 2018 15:28:51 GMT
In our JIRA: https://issues.apache.org/jira/projects/MYFACES/issues/

A small maven application with jetty-maven-plugin would be a great example!

2018-01-25 16:24 GMT+01:00 Matthew Broadhead <matthew.broadhead@nbmlaw.co.uk
>:

> ok i will do that.  where do i create an issue?
>
>
> On 25/01/2018 16:20, Thomas Andraschko wrote:
>
>> Could you please provide a mvce and create a issue?
>> Otherwise it's almost impossible to help you.
>>
>> 2018-01-25 16:14 GMT+01:00 Matthew Broadhead <
>> matthew.broadhead@nbmlaw.co.uk
>>
>>> :
>>> hi,
>>> i just posted this question on stack overflow.  but then i tested
>>> switching to mojarra and that solved my problem so i guessed i would
>>> report
>>> it to this list
>>>
>>> Consider the following xhtml fragment:
>>>
>>> <h:form>
>>> <h:outputText value="#{myBean.items.size()}" />
>>> <ui:repeat var="item" value="#{myBean.items}">
>>>      <div>
>>>          <h:outputText value="#{item.id} #{item.name}" />
>>>          <h:commandButton value="delete" action="#{myBean.delete}">
>>>              <f:setPropertyActionListener target="#{myBean.item}"
>>> value="#{item}" />
>>>              <f:ajax render="@form" />
>>>          </h:commandButton>
>>>      </div>
>>> </ui:repeat>
>>> <c:forEach var="item" items="#{myBean.items}">
>>>      <div>
>>>          <h:outputText value="#{item.id} #{item.name}" />
>>>      </div>
>>> </c:forEach>
>>> </h:form>
>>> With the backing bean delete method:
>>>
>>> @Transactional
>>> public String delete() {
>>>      itemDao.delete(getItem());
>>>      setItems(itemDao.select());
>>>      return null;
>>> }
>>> And the itemDao methods like:
>>>
>>> public List<Item> select() {
>>>      CriteriaBuilder cb = em.getCriteriaBuilder();
>>>      CriteriaQuery<Item> cq = cb.createQuery(Item.class);
>>>      Root<Item> item = cq.from(Item.class);
>>>      cq.distinct(true);
>>>      TypedQuery<Item> query = em.createQuery(cq);
>>>      List<Item> itemList = query.getResultList();
>>>      return itemList;
>>> }
>>> public void delete(Project project) {
>>>      project = find(project.getProjectId());
>>>      em.remove(project);
>>> }
>>> The problem is that after the delete button is clicked the count is
>>> correct, the c:forEach is correct, but the ui:repeat is not updated and
>>> still shows the deleted element. Can someone suggest how to force the
>>> ui:repeat to also refresh?
>>>
>>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message