我有一个数据表,每行都有一个
<p:commandButton styleClass="edit-promo-img" action="#{branchController.prepareEdit}" value="" oncomplete="updateBranchForm()"/>
这是我的模式:
<div id="edit-branch-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<h:form id="editBranchForm">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
Branch Details
</div>
<div class="modal-body">
<div><h:outputLabel value="#{bundle.CreateBranchLabel_name}" for="name" /></div>
<div><h:inputText id="name" value="#{branchController.selected.name}" title="#{bundle.CreateBranchTitle_name}" required="true" requiredMessage="#{bundle.CreateBranchRequiredMessage_name}"/></div>
</div>
<div class="modal-footer">
<p:commandButton action="#{branchController.update}" value="#{bundle.CreateBranchSaveLink}" />
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
<p:remoteCommand name="updateBranchForm" update="@form" />
</h:form>
prepareEdit方法:
public void prepareEdit() {
current = (Branch) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
}
选择的方法:
public Branch getSelected() {
if (current == null) {
current = new Branch();
selectedItemIndex = -1;
}
return current;
}
当我在getSelected方法上调试时,我的“当前”对象上确实存在正确的数据。
我的问题是,模态中的输入没有数据。
将JSF 2.0与Primefaces一起使用,而我的bean正在使用ViewScope。