开发者

How to update properties of an array of beans while iterating in jspx

开发者 https://www.devze.com 2023-04-04 03:03 出处:网络
The model returns a list of beans which are displayed in a table using <c:forEach tag>. Some properties are of type input, so the user can edit these inline (optional).

The model returns a list of beans which are displayed in a table using <c:forEach tag>. Some properties are of type input, so the user can edit these inline (optional).

The开发者_开发知识库 question is how to set a corresponding beanObject[by row index] when user clicks on checkbox? If clicked, then the appropriate bean needs to be updated via AJAX, I think.

So, how can we do that?

Normal Master-Detail approach has way too many clicks, that is why I need "update-able" tables.

Controller:

return new ModelAndView("daily","daily", dailyListOfBeansRecords;

Jspx:

form submit...
...
<c:forEach var="week" items="${Daily}"  varStatus="loopIteratorValue">
    <tr class="${loopIteratorValue.index % 2 == 0 ? 'd4' : 'd3'}">
        <td><checkbox id="present" onchange="ProcessedUpdated(this,${loopIteratorValue.index})" value="${week.processed}"/></td>
    </tr>
</c:forEach>


It seems to me you totally misunderstand jsp. jsp(x) is executed on the server side. you need javascript to do client-side processing.

0

精彩评论

暂无评论...
验证码 换一张
取 消