Is it possible to access say the 3rd element in a collection with Struts?

社会主义新天地 提交于 2019-12-13 00:01:47

问题


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

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