Eliminar mensajes de error JSF

I am using JSF 2 with primefaces 3.3.1.

I used the form tag in my template.xhtml page and I included all my pages inside that. So all pages are under the same form. My scenario is: I have two panels, one is customer search panel and another one is customer search results panel. Customer search panel contains some text boxes and one command button. In that text boxes I will give some inputs about the customer and I will click the commandbutton. After that I have to load the customer search results panel that will contain one datatable with search results.

Initially I will load only the customer search panel. once I click the command button then only I will load the customer search panel. In that commandbutton of my customer search panel I have given the customer search result panel id in the update attribute. Like

<p:commandButton value="click" action="#{bean.action}" update="cust_search_panel"/>

When I press the commandbutton jsf says 'Cannot find component with the identifier cust_search_panel'. Because initially I will not load the customer search result panel so that id will not be there.

When using the primefaces 2.2.1 there is no issue because if the component is not in the form then they will add info message saying 'Cannot find component with the identifier cust_search_panel'. but in the primefaces 3.3.1 they changed that info message to error message. So now my page is not getting loaded because of this error.

When we receive messages like 'Cannot find component with the identifier cust_search_panel' this then if it is possible to remove that error message from the facescontext then my pages will load properly right?

I have not found any solution other then this. Could anyone help me out to solve this issue.

Gracias de antemano.

preguntado el 24 de agosto de 12 a las 09:08

3 Respuestas

Has probado con

<p:commandButton value="click" action="#{bean.action}" update=":cust_search_panel"/>


Respondido 24 ago 12, 13:08

I do not know of any other easy solution. But this should work:

Update the component from your action method and remove the update attribute on the button.

if (context.getViewRoot().findComponent("myForm:cust_search_panel") != null){

Respondido 24 ago 12, 13:08

Referring to a non-existing element is wrong and JSF should show an error. If JSF would permit to load the page, this would result in JavaScript errors.

The proper way to handle this is to refer to a parent element. So in your case you should render the panel and hide the data table. The command button should update the panel, which contains the data table.


<p:commandButton value="click" action="#{bean.action}" update="cust_search_panel"/>

<your-container id="cust_search_panel">
    <p:dataTable rendered="#{bean.someCondition" .../>

Respondido 25 ago 12, 12:08

Thank you so much siebz0r for your help.. your suggestion saved me - Manos

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.