[英]PanelGrid and OutputLabel
I got a problem with this code. 我对此代码有问题。 I want to have a SelectOneMenu where I select a Customer (this one works fine for me).
我希望有一个SelectOneMenu,我可以在其中选择一个客户(这个对我来说很好用)。 But after I selected an element, I should see the ID of this Customer in a OutputText.
但是,在选择元素之后,我应该在OutputText中看到该客户的ID。 This does not work:
这不起作用:
<h:form id="form">
<h:panelGrid columns="2">
<h:outputLabel for="customer" value="Customer: " />
<h:selectOneMenu id="customerList"
value="#{customerController.selected}" required="true">
<f:selectItems value="#{customerController.items}"
var="customer"
itemLabel="#{customer.id} #{customer.firstname} #{customer.lastname} #{customer.email}"
itemValue="customer" />
<p:ajax update=":form:myId" />
</h:selectOneMenu>
<h:outputLabel value="Customer ID: " for="myId" />
<h:outputText id="myId"
value="#{customerController.selected.id}" />
</h:panelGrid>
</h:form>
Any Ideas? 有任何想法吗?
尝试使用:
<p:ajax update="myId" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.