如何将普通的html复选框语法转换为弹簧形式:复选框

时间:2022-05-19 20:31:51

I have this

我有这个

<c:forEach items="${countryList}" var="var1" varStatus="counter">
<input type="checkbox" name="passports[${counter.index}].country_issue" value="${var1.country_name}" >${var1.country_name}</input>
    </c:forEach>

Now i want to convert it to something like

现在我想把它转换成类似的东西

<form:checkboxes path="passports[${counter.index}].country_issue"

The problem here is that how will i use varStatus here for counter

这里的问题是我将如何在这里使用varStatus作为计数器

1 个解决方案

#1


0  

you don't need it I guess, would this not work?:

我猜你不需要它,这不起作用吗?:

<form:checkboxes path="passports.country" items="${countryList}" />

I don't fully understand what you're trying to achieve; you're using the index of one list (countries) as the index for another list (passports)?

我不完全明白你想要实现的目标;您是使用一个列表(国家/地区)的索引作为另一个列表(护照)的索引?

If for some reason you do need the varStatus then you'll need to use form/checkbox instead.

如果由于某种原因你确实需要varStatus,那么你需要使用form / checkbox。

regards,
Stijn

#1


0  

you don't need it I guess, would this not work?:

我猜你不需要它,这不起作用吗?:

<form:checkboxes path="passports.country" items="${countryList}" />

I don't fully understand what you're trying to achieve; you're using the index of one list (countries) as the index for another list (passports)?

我不完全明白你想要实现的目标;您是使用一个列表(国家/地区)的索引作为另一个列表(护照)的索引?

If for some reason you do need the varStatus then you'll need to use form/checkbox instead.

如果由于某种原因你确实需要varStatus,那么你需要使用form / checkbox。

regards,
Stijn