1
votes

I'm working in a project wich uses JSF 2.0 with PrimeFaces 2.2 . Currently we're working with a wizard (PrimeFaces component) that will guide the user through the registration process. We have 4 steps in the wizard.

Here's the problem: in the first Step the user enters his/her personal details and that got updated correctly in the backing bean. Step 2 is just a bunch of text and Step 3 presents another form to enter extra information.

But in step 3 the data isn't updated in the backing bean and the properties remains null. I've tried some workarounds but nothing changed...

Well, here is the relevant parts of the code:

            <p:tab id="three" title="Passo 3" >
                       <p:panel header="Sua saúde financeira">
                            <p:messages  />
                             <h:panelGrid cellpadding="5" columns="2">
                                <h:outputText value="Você possui alguma reserva? (Dinheiro não investido, coloque 0,00 se não tiver reserva) " />
                                <h:panelGrid cellpadding="5" columns="2">
                                    <p:inputText id="reserva" value="#{userWizard.actualMoneyReserve}" size="5" required="true" /> <h:outputText value=" reais." />
                                </h:panelGrid>
                                <h:outputText value="Qual o valor que você planeja investir por mês? (0,00 se não tiver um planejamento) " />
                                <h:panelGrid cellpadding="5" columns="2">
                                    <p:inputText id="valormensal" value="#{userWizard.monthlyInvestment}" size="5" required="true" /> <h:outputText value=" reais." />
                                </h:panelGrid>
                                <h:outputText value="Qual o valor do seu salário atual?  " />
                                <h:panelGrid cellpadding="5" columns="2">
                                    <p:inputText id="salario" value="#{userWizard.salary}" size="5" required="true" /> <h:outputText value=" reais." />
                                </h:panelGrid>
                                <h:outputText value="Quanto você gasta por mês ?  " />
                                <h:panelGrid cellpadding="5" columns="2">
                                    <p:inputText id="gastomensal" value="#{userWizard.lifeCost}" size="5" required="true" /> <h:outputText value=" reais." />
                                </h:panelGrid>
                            </h:panelGrid>
                        </p:panel>
                    </p:tab>

This is from the view, and the backing bean:

        private String actualMoneyReserve;
    private String monthlyInvestment;
    private String salary;
    private String lifeCost;    public void save() {
    //Persist user

    this.moneyHealth.setActualMoneyReserve(actualMoneyReserve);
    this.moneyHealth.setLifeCost(lifeCost);
    this.moneyHealth.setMonthlyInvestment(monthlyInvestment);
    this.moneyHealth.setSalary(salary);

    this.user.setMoneyHealth(this.moneyHealth);
    JOptionPane.showMessageDialog(null, this.actualMoneyReserve);
    JOptionPane.showMessageDialog(null, this.moneyHealth.getActualMoneyReserve());

    GenericDAO<User> gd = new GenericDAO<User>(User.class);
    gd.persist(user);
}

I've already exhausted all possible solutions... So please if someone have at least a vague idea, it's valid. Thanks!

1

1 Answers

0
votes

It's hard to naildown the root cause with the information given as far. At least one possible cause: one of the parent components of the input fields has a rendered attribtue which evaluated false at the point the input values are to be gathered. Ensure that the rendered condition evaluates the same during form submit as it did during form display.