Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 如何在动态列表中使用Primefaces SelectOneRadio的自定义布局_Jsf_Primefaces - Fatal编程技术网

Jsf 如何在动态列表中使用Primefaces SelectOneRadio的自定义布局

Jsf 如何在动态列表中使用Primefaces SelectOneRadio的自定义布局,jsf,primefaces,Jsf,Primefaces,Primefaces提供了定制p:selectOneRadio布局的选项,这是一个好的选项,优于生成的树型JSF h:selectOneRadio 但在我看到的任何地方,在固定/静态单选按钮上使用这种自定义布局,甚至在Primefaces中。如果他们使用过: <p:selectOneRadio id="customRadio" value="#{formBean.option}" layout="custom"> <f:selectItem itemLab

Primefaces提供了定制p:selectOneRadio布局的选项,这是一个好的选项,优于生成的树型JSF h:selectOneRadio

但在我看到的任何地方,在固定/静态单选按钮上使用这种自定义布局,甚至在Primefaces中。如果他们使用过:

 <p:selectOneRadio id="customRadio" value="#{formBean.option}" layout="custom">  
        <f:selectItem itemLabel="Option 1" itemValue="1" />  
        <f:selectItem itemLabel="Option 2" itemValue="2" />  
        <f:selectItem itemLabel="Option 3" itemValue="3" />  
    </p:selectOneRadio>  
怎么做?还有其他选择吗


在我的应用程序中使用:JSF 2.1.13和Primefaces 3.5,我有一个这样的实现,我正在共享代码

 <p:selectOneRadio value="#{insertbean.lagCalid}" layout="pageDirection">
<f:selectItems value="#{insertbean.calendars}" var="cal" itemLabel="#{cal.calendarName}" itemValue="#{cal.calrowid}" />
</p:selectOneRadio>

拉格卡利德有一个接球手;calendars是List类型,Calendar是我自己的模型类。日历有一个getter方法,其中填充了数据。pageDirection具有与primefaces showcase相同的自定义视图。

在我的应用程序中,我有一个这样的实现,我正在共享代码

 <p:selectOneRadio value="#{insertbean.lagCalid}" layout="pageDirection">
<f:selectItems value="#{insertbean.calendars}" var="cal" itemLabel="#{cal.calendarName}" itemValue="#{cal.calrowid}" />
</p:selectOneRadio>

拉格卡利德有一个接球手;calendars是List类型,Calendar是我自己的模型类。日历有一个getter方法,其中填充了数据。pageDirection具有与primefaces showcase相同的自定义视图。

解决此问题的一个方便方法是使用JSTL c:forEach和f:selectItems,就像您在问题中编写的那样。可以添加以下内容来定义布局:

<c:forEach items="#{formBean.mySelectItemList}" var="item" varStatus="loop">
    <p:radioButton id="customRadioButton" for="customRadio" itemIndex="#{loop.index}" />
    <!-- whatever custom layout you prefer here -->
    <p:inputText />
</c:forEach>

解决这个问题的一个方便方法是使用jstlc:forEach和f:selectItems,就像您在问题中写的那样。可以添加以下内容来定义布局:

<c:forEach items="#{formBean.mySelectItemList}" var="item" varStatus="loop">
    <p:radioButton id="customRadioButton" for="customRadio" itemIndex="#{loop.index}" />
    <!-- whatever custom layout you prefer here -->
    <p:inputText />
</c:forEach>

这不是我想要的。我知道如何使用f:selectItems中的POJO,我不是要求layout=pageDirection。我想在有f:selectItems时使用layout=custom,并将下拉列表和其他组件与单选按钮一起放置。请看我在问题中提供的Primefaces链接。请注意这个问题@KishorP需要自定义布局。这不是我想要的。我知道如何使用f:selectItems中的POJO,我不是要求layout=pageDirection。我想在有f:selectItems时使用layout=custom,并将下拉列表和其他组件与单选按钮一起放置。请看我在问题中提供的Primefaces链接。请注意这个问题@KishorP需要自定义布局。