Announcement Announcement Module
Collapse
No announcement yet.
wrong value from ${status.value} in spring:bind Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • wrong value from ${status.value} in spring:bind

    i have a jsp where i show the a resultlist with spring:bind, because i can change directly something per entry and i want to save the changes.

    Code:
    <form:form commandName="resultList" method="POST" name="resultForm">
    <form:hidden path="listIndex" id="listIndex"/>
    <c:forEach items="${resultList.results}" var="item" varStatus="gridRow">
      <tr>
        <td>
          <spring:bind path="resultList.results[${gridRow.index}].listingId">
            <c:out value="${status.value}"/>
            <input type="hidden" name="${status.expression}"
                                 id="${status.expression}"
                                 value="${status.value}"/>
          </spring:bind>
        </td>
        <td>
          <spring:bind path="resultList.results[${gridRow.index}].businessName">
            <c:out value="${status.value}"/>
            <input type="hidden" name="${status.expression}"
                                 id="${status.expression}"
                                 value="${status.value}"/>
          </spring:bind>
        </td>
        <td>
          <spring:bind path="resultList.results[${gridRow.index}].content">    
            Review (latest revision):<br />
            <input type="text" name="${status.expression}"
                               id="${status.expression}"
                               value="${status.value}" />
          </spring:bind>
        </td>
        <td>
          <spring:bind path="resultList.results[${gridRow.index}].sourceId">
            <c:out value="${status.value}"/>
            <input type="hidden" name="${status.expression}"
                                 id="${status.expression}"
                                 value="${status.value}"/>
          </spring:bind>
        </td>
        <td>
          <spring:bind path="resultList.results[${gridRow.index}].display">
            <c:if test="${status.value == true}">
              <input type="checkbox" name="${status.expression}"
                                     id="${status.expression}"
                                     value="true"
                                     checked="checked"/>
            </c:if>
            <c:if test="${status.value == false}">
              <input type="checkbox" name="${status.expression}"
                                     id="${status.expression}"
                                     value="true"/>
            </c:if>
          </spring:bind>
        </td>
        <td>
          <spring:bind path="resultList.results[${gridRow.index}].inappropriateContent">
            <c:if test="${status.value == true}">
              <input type="checkbox" name="${status.expression}"
                                     id="${status.expression}"
                                     value="true"
                                     checked="checked"/>
            </c:if>
            <c:if test="${status.value == false}">
              <input type="checkbox" name="${status.expression}"
                                     id="${status.expression}"
                                     value="true"/>
            </c:if>
          </spring:bind>
        </td>
        <td>
          <spring:bind path="resultList.results[${gridRow.index}].active">
            <c:if test="${status.value == true}">
              <input type="checkbox" name="${status.expression}"
                                     id="${status.expression}"
                                     value="true"
                                     checked="checked"/>
            </c:if>
            <c:if test="${status.value == false}">
              <input type="checkbox" name="${status.expression}"
                                     id="${status.expression}"
                                     value="true"/>
            </c:if>
          </spring:bind>
        </td>
        <c:url value="itemdetails.do" var="url">
          <c:param name="reviewId" value="${item.reviewId}"/>
          <c:param name="listId" value="${item.listingId}"/>
        </c:url>
        <td><a href="${url}" class="btn">Details</a></td>
        <td><a href="javascript:submitResultForm(${gridRow.index});" class="btn">Save</a></td>
      </tr>
    </c:forEach>
    </form:form>
    after calling the page i see the status.value correctly. i can unselect one entry, save it and after saving i want to see the list without the unselected entry. the problem is, that i can see the unselected entry, but i can't see the last entry. after researching i found out, that status.value is switched, so it shows me the wrong values.
    if i'll call the page again, i can see the values correctly again.
    in the meantime i replaced status.value with item.<property> and that works, but that can't be the solution.

    does somebody know this problem or what am i doing worng?

    regards, simon
Working...
X