I have a page with several h:selectOneMenu
or p:selectOneMenu
and I want to use the same page for editing and adding data.
When I will edit data I need f:selectItem
. I know that this component doesn't have attribute rendered. And I read that I can use <c:if>
.
Ok. For example, if I write
<p:selectOneMenu rendered="#{not empty bean.id}"
value="#{bean.selectedId}">
<c:if test="${editableBean != null}">
<f:selectItem itemLable="#{editableBean.name} itemValue=#{editableBean.id} />
</c:if>
<f:selectItems value="#{bean.listItems}" var="item"
itemLabel="#{item.name}" itemValue="#{item.id}"/>
</p:selectOneMenu>
Will it works without any problems in primefaces and with ajax listeners?