Primefaces - Requestcontext Update

Asked

Viewed 553 times

0

Hello, When loading the page the method iniciarTeste() will be called as follows:

<f:metadata>
    <f:viewAction action="#{testeController.iniciarTeste()}" />
</f:metadata>

On the same page I have the field nome that I would like to load with the value assigned in testeController

<ui:define name="body">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-default">
                <h:form id="testeForm" name="testeForm">
                <div class="box-body">
                   <div class="form-group col-md-12" id="divNome" name="divNome" >
                        <p:outputLabel value="#{testeController.nome}" id="nome" />
                    </div>
      .
      .
      .

Follow the method:

Public String nome;

public void iniciarTeste() {
    RequestContext context = RequestContext.getCurrentInstance();
    context.update("testeForm:nome");       
}

I took the test too with:

context.update(":testeForm:nome");

When the update will be performed:

Cannot find component for expression "testeForm:nome" referenced from "j_id1"

Do you know what I’m doing wrong? Or any idea how I can do it differently?

Thank you

  • Your Requestcontext is from Primefaces?

  • Yes... Primefaces (org.primefaces.context.RequestContext).

  • Hello, try to include the attribute prependId="false" in your form. Ai in Requestcontext would look like this context.update("nome"); Tell us if it worked, or if the error continues.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.