首页 > 解决方案 > 参数未在 Bean 中更新

问题描述

我面临一个奇怪的问题,我可以在 jsf 页面中以可编辑格式从数据库中获取数据,但是当我单击更新按钮时,新数据没有传递给 bean。基本上我正在尝试编辑已经提交的表单。

以下是我的代码:

jsf:

<h:form id="updateTraining">
    <p:panelGrid id="update_training" style="width:800px" >
        <p:row>
            <p:column width="22%" style="align:left;">
                Title
            </p:column>
            <p:column width="78%" style="align:left;" colspan="3">
                <p:inputText id="trainingTitle" value="#{trainingModule.trainingTitle}" />
            </p:column>
        </p:row>

        <p:commandButton action="#{trainingModule.forwardTrainingDetails}" value="FORWARD" update="growl">
            <f:param name="employeeId" value="#{login.employeeId}" />
        </p:commandButton>
    </p:panelGrid>
</h:form>

豆:

    @ManagedBean
    @SessionScoped
    public class TrainingModule {

    private String trainingTitle;
    //Getters and Setters
    public String forwardTrainingDetails() throws Exception
        {
            System.out.println("Training TITLE:: " +trainingTitle);
        }
}

但是当我更改 Training Title 的值时,新值不会在 bean 中更新。我尝试使用 process="@this,trainingTitle" ,但仍然没有运气。非常感谢任何帮助。

谢谢并恭祝安康

标签: jsfprimefaces

解决方案


推荐阅读