获得特定元素中使用的EL列表或数组 [英] Get specific element in a list or array using EL
本文介绍了获得特定元素中使用的EL列表或数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能获得特定元素在Java EE页面(Facelets的或JSP)使用EL列表或数组,或做我必须创建一个自定义的方法EL?
Is it possible to get specific element in list or array using EL in a Java EE page (Facelets or JSP), or do I have to create a custom EL method?
推荐答案
您可以用括号标记 []
,其中指定的的(从零开始)指数元素,您想检索。
You can use the brace notation []
wherein you specify the (zero-based) index of the element you'd like to retrieve.
<p>This is the 3rd item of the list: #{bean.list[2]}</p>
这个语法确实基本相同 bean.getList()获取(2)
。
This syntax does basically the same as bean.getList().get(2)
.
这是等同于数组。
<p>This is the 3rd item of the array: #{bean.array[2]}</p>
这个语法确实基本相同 bean.getArray()[2]
。
This syntax does basically the same as bean.getArray()[2]
.
- Our EL wiki page
这篇关于获得特定元素中使用的EL列表或数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文