JSF - Browse and print values from ArrayList<String[]> using EL
I have an ArrayList from a开发者_如何学Python Bean :
...
public ArrayList<String[]> getArticleList() {
...
}
...
I need to print these values (with getter method) by using EL on JSF2 (such as #{bean.articlesLage}
How can I do this? Cheers
I don't remember if JSF supports arrays, however if you can convert your ArrayList<Array>
to ArrayList<ArrayList<String>>
, then something like this should work
<ui:repeat value="#{bean.articleList}" var="t">
<ui:repeat value="#{t}" var="s">
#{s}
</ui:repeat>
</ui:repeat>
You can use a nested ui:repeat or a nested datatable like this with your current model ArrayList :
<h:dataTable value="#{bean.articleList}" var="row">
<h:column>
<f:facet name="header">
<h:outputText value="COL" />
</f:facet>
<h:dataTable value="#{row}" var="nested_row">
<h:column>
<f:facet name="header">
<h:outputText value="COL" />
</f:facet>
<h:outputText value="#{nested_row}" />
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>
精彩评论