How to achieve correct values for attribute `name` when I use <nested:iteration> inside <nested:iteration> in the Struts?

为君一笑 提交于 2020-04-23 10:10:11

问题


To render Map<String, List<MyObject>> I have a jsp like this:

....
<nested:iterate property="MyMap" id="entry">
    <bean:write name="entry" property="key"/>
    <nested:iterate name="entry" property="value" indexId="count" id="myBean">
        <div class="">
            <nested:define name="myBean" id="myBeanName" property="name"/>
            <nested:hidden property="description"></nested:hidden>
            <nested:hidden name="myBean" property="name"/>
            <nested:checkbox styleId='<%="enabled-"+myBeanName%>' property="enabled"/>
            <label for="enabled-<nested:write name="myBeanName" property="name"/>"><nested:write name="myBeanName" property="description"/></label>
        </div>
    </nested:iterate>
</nested:iterate>
....

The problem here that after compilation into HTML we see wrong name attribute values although value attributes are coorect:

...
<div class="">
    <input type="hidden" name="value[0].description" value="correct_description">
    <input type="hidden" name="name" value="coorect_name">
    <input type="checkbox" name="value[0].enabled" value="on" id="correct_value">
    <label for="enabled-encDevAddr">correct_description</label>
</div>
...

How to achieve correct values for attribute name?

来源:https://stackoverflow.com/questions/60940313/how-to-achieve-correct-values-for-attribute-name-when-i-use-nestediteration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!