Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jsf - "Cannot find component with expression" [duplicate]

I'm using PrimeFaces and a component within one layoutUnit must update another component which is within another layoutUnit:

<p:layout>
  <p:layoutUnit position="west" size="275" resizable="true" closable="true" collapsible="true">
    <h:form id="formWest">
      <div id="west">
        <ui:insert name="west"></ui:insert>
      </div>
    </h:form>
  </p:layoutUnit>
  <p:layoutUnit id="layout_center" position="center">
    <h:form id="formCenter">
      <div id="content">
        <ui:insert name="content"></ui:insert>
      </div>
    </h:form>
  </p:layoutUnit>
</p:layout>

The error message is: Caused by: javax.faces.FacesException: Cannot find component with expression "formWest:execucao" referenced from "formCenter:form:mapaGoogle".

The components that need to be updated are inside td so I did <td jsf:id="execucao">, for example.

like image 783
Rasshu Avatar asked Aug 02 '14 01:08

Rasshu


1 Answers

As you know when you refer components from another form you have to attach the form ID to the component Id.

You also need to know that you have to attach another : before the form ID, when refereing the compnent in different form.

Example:

<h:form id="form1">
    <p:inputText id="input1" />
</h:form>

Now if I want to update the input1 from another form I have to use:

:form1:input1

Example:

<h:form id="form2">
   <p:commandButton update=":form1:input1" />
</h:form>

In your case use:

:formWest:execucao
like image 184
Kishor Prakash Avatar answered Oct 28 '22 23:10

Kishor Prakash