调用参数化方法c:foreach来创建selectOneMenu

时间:2018-01-16 09:54:38

标签: jsf primefaces jstl

我正在尝试根据convertJsonToList方法的返回列表动态构建selectOneMenu。我尝试过使用f:selectItems, c:forEach, ui:repeat,但没有确定...有关详细信息,请查看以下代码。

如何在selectOneMenu下拉列表中调用参数化的convertJsonToList?

      <p:selectOneMenu  id="selectOneMenu"  scrollHeight="100" 
         value="#{viewEventStatusController.operationId}"  autoWidth="false" style="#{componentUnit.style}" styleClass="selectOperationOneMenu" rendered="#{componentUnit.type == 'selectOneMenu'}">

          <!-- I have to set an index, therefore I tried to use forEach -->  
          <f:selectItems value="#{viewEventStatusController.convertJsonToList(chat.operations)}" var="opration" itemValue="1" itemLabel="#{operation}" />                                               

          <!-- Here the  convertJsonToList is not being called I think because it is parametrized!-->
          <c:forEach items="#{viewEventStatusController.convertJsonToList(chat.operations)}" var="operation" varStatus="count">
              <f:selectItem itemLabel="#{operation}"   itemValue="#{count.index}" />
          </c:forEach>

           <!-- the convertJsonToList method is not being called!  -->
          <ui:repeat value="#{viewEventStatusController.convertJsonToList(chat.operations)}">
          </ui:repeat>

      </p:selectOneMenu>

0 个答案:

没有答案