呼叫辅助bean方法与数组作为参数

问题描述 投票:0回答:1

我怎么能传递一个Array一个Bean在JSF。

例:

豆角,扁豆:

@ManagedBean(name="bean")
...
/* Method I want to call*/
public String output(String[] strings) {
...
}

JSF:

<h:outputText value="#{bean.output( ??? )}"/>
jsf
1个回答
5
投票

您不能创建在EL一个数组,但你可以创建一个字符串与特定的分隔符,然后用JSTL fn:split()到它的分隔符分成数组。

<html ... xmlns:fn="http://java.sun.com/jsp/jstl/functions">
...
<h:outputText value="#{bean.output(fn:split('one,two,three', ','))}" />
© www.soinside.com 2019 - 2024. All rights reserved.