jsp中EL表达式向后台传递list集合对象

jsp页面代码:

<form:form id="update" modelAttribute="enterpriseNumInfoListSelf" action="${ctx}/enterprise/num/update" method="post">
    <c:forEach items="${enterpriseNumInfoSelfList}" var="enterpriseNumInfoSelf" varStatus="status">
        <tr>
            <td>${enterpriseNumInfoSelf.depName}</td>
            <td>${enterpriseNumInfoSelf.diversionYear}</td>
            <input type="hidden" name = "enterpriseNumInfoSelfList[${status.index}].safetyNumEnterpriseId" value="${enterpriseNumInfoSelf.safetyNumEnterpriseId}">
            <td><input name="enterpriseNumInfoSelfList[${status.index}].gaugeNum" type="text" value="${enterpriseNumInfoSelf.gaugeNum}" disabled="disabled"></td>
            <td><input name="enterpriseNumInfoSelfList[${status.index}].theRules" type="text" value="${enterpriseNumInfoSelf.theRules}" disabled="disabled"></td>
            <td><input name="enterpriseNumInfoSelfList[${status.index}].dangerousEnt" type="text" value="${enterpriseNumInfoSelf.dangerousEnt}" disabled="disabled"></td>
        </tr>
    </c:forEach>
</form:form>

易错点:1.input提交前先将$("input").removeAttr("disabled");否则没有数据提交到后台.

             2.input中加disabled是为了在编辑的时候成为可输入框,保存后成为只读状态,其中切换是否只读状态就是将disabled属性内容附为true或false即可;

             3.modelAttribute中的对象必须是内部含有list对象集合的外层对象,将之当参数传入后台即可。

            4.input中name属性值是modelAttribute中list对象的属性名称;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值