PanelGrid和OutputLabel

时间:2013-05-21 14:38:00

标签: java html xml jsf primefaces

我遇到了这个代码的问题。我希望有一个SelectOneMenu,我选择一个客户(这个对我来说很好)。但是在我选择了一个元素之后,我应该在OutputText中看到这个Customer的ID。这不起作用:

<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>

任何想法?

1 个答案:

答案 0 :(得分:0)

尝试使用:

<p:ajax update="myId" />
相关问题