0

このコードに問題がありました。Customer を選択する SelectOneMenu が必要です (これは私にとっては問題ありません)。しかし、要素を選択すると、この Customer の ID が OutputText に表示されるはずです。これは動作しません:

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

何か案は?

4

1 に答える 1

0

使用してみてください:

<p:ajax update="myId" />
于 2013-05-21T23:26:09.733 に答える