如何使用 Primefaces 和 Ajax(或不使用)逐部分呈现 xhtml 页面。其他一切正常,当用户按下复选框时,会显示消息,但用户名内容永远不会更新。在这种情况下如何刷新面板网格?我是 AJAX 的新手,从今天开始 :)
<h:outputLabel value="Do you want to create username?" for="description" />
<p:selectBooleanCheckbox value="#{testController.selectedNew.asUser}">
<p:ajax update="msg" listener="#{testController.selectedNew.addMessage()}"/>
<p:ajax update="usernamecontent"/> ------> **This is not working!**
</p:selectBooleanCheckbox>
<h:panelGrid columns="2" id="usernamecontent" rendered="#{testController.selected.asUser}">
<h:outputLabel value="#{bundle.CreateUserLabel_userUsername}" for="username" />
<p:inputText id="username" value="#{testController.selectedNew.userUsername.username}" title="#{bundle.CreateUsersTitle_username}" required="true" requiredMessage="#{bundle.CreateUserRequiredMessage_username}"/>
<h:outputLabel value="#{bundle.CreateUsersLabel_password}" for="password" />
<p:inputText id="password" value="#{testController.selectedNew.userUsername.password}" title="#{bundle.CreateUserTitle_password}" required="true" requiredMessage="#{bundle.CreateUserRequiredMessage_password}"/>
</h:panelGrid>
谢谢萨米