问题
Is there a way to do the following thing in Struts / JSP?
<html:checkbox property="list.get(0).checked" />
Thank you in advance.
回答1:
If you want to access the 3rd element in a list in JSTL, the syntax is just like arrays:
<html:checkbox property="list[2].checked" />
Note that if you are new to JSTL/EL you'll have to add the appropriate jar to your classpath and reference the tag library.
来源:https://stackoverflow.com/questions/3062350/is-it-possible-to-access-say-the-3rd-element-in-a-collection-with-struts