这是我的JSF .xhtml代码。问题是,当JSF值发生变化时,它不会被发送到服务器。 save.its仍然只是向服务器发送更早的值 请帮我解决这个问题
谢谢大家: - )
<ui:decorate template="/jsf/templates/one_column.xhtml">
<ui:define name="label">
<h:outputText value="Card Status" style="font-weight:bold;" />
</ui:define>
<ui:define name="field">
<h:selectOneMenu value="#{profileController.selectedBean.title}">
<f:selectItems value="#{profileController.titles}"/>
</h:selectOneMenu>
<h:selectOneMenu
value="#{cardManagementController.selectedCardBean.cardStatusId}" >
<f:selectItem itemValue="null" itemLabel="please select"
noSelectionOption="true" />
<f:selectItems
value="#{cardManagementController.listCardTypeStatus}"
var="cardStatus" itemLabel="#{cardStatus.name}"
itemValue="#{cardStatus.statusId}" />
</h:selectOneMenu>
</ui:define>
</ui:decorate>
在这里我将展示我的班级代码
private CardBean selectedCardBean = new CardBean();
public void editCard() {
if (selectedCardBean != null) {//THIS selectedCardBean is still shows earlier records
cardService.editCardInformation(selectedCardBean);
selectedCardBean = new CardBean();
editCardEnabled = false;
}
searchCard();
}
已添加代码
<!-- Buttons -->
<ui:decorate template="/jsf/templates/one_column.xhtml">
<ui:define name="label">
</ui:define>
<ui:define name="field">
<a4j:commandButton value="Submit" execute="@form"
action="#{cardManagementController.editCard()}"
render="#{rich:clientId('hpnlRes')} #{rich:clientId('hpnlSearch')} #{rich:clientId('hpnlEdit')}" />
<a4j:commandButton value="Back" style="margin-left:10px;"
action="#{cardManagementController.hideEditCard()}"
render="#{rich:clientId('hpnlRes')} #{rich:clientId('hpnlSearch')} #{rich:clientId('hpnlEdit')}" />
</ui:define>
</ui:decorate>
答案 0 :(得分:0)
我的控制器类问题..我修复了所有
我得到物品价值 但从形式传递其身份
thatswhy
<f:selectItems
value="#{cardManagementController.listCardTypeStatus}"
var="cardStatus" itemLabel="#{cardStatus.name}"
itemValue="#{cardStatus.statusId}" />