我创建了另一个问题,希望能找到答案,但我走错了方向。这是供参考的问题(如何将其解析为多值映射?)
我从属性文件中拉出一个字符串数组(使用 Apache 配置),然后数组进来,看起来像这样
name,5486984,189.658.235.215,3.158.68.15,name2,189189,189.658.218.268,3.158.68.13...
这是JSF的一部分
<f:selectItems itemValue="#{mainBean.information}" value="#mainBean.information}" />
这是Java的片段
Private String [] information;
information = config.getStringArray("information"); // This brings in this string from the property file
我一直在参考这个http://www.horstmann.com/corejsf/refcard.html
因此,就我在这里所拥有的而言,我刚刚发布了。它将填充该字符串数组的每个元素。我只希望显示“名称”并将其他三个值作为实际“值”传递。
我试图制作一个 Map 对象,它是一个字符串和一个字符串数组,但 JSF 拒绝接受它。