My application does not find my method

Asked

Viewed 247 times

1

Take a look at the error message;

jul 28, 2015 8:12:39 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
GRAVE: Error Rendering View[/noticias/PesquisaNoticias.xhtml]
javax.el.PropertyNotFoundException: /noticias/PesquisaNoticias.xhtml @27,87 value="#{cadastroNoticiaBean.filtro.titulo}": Property 'filtro' not found on type br.com.vendelancha.controller.CadastroNoticiaBean$Proxy$_$$_WeldClientProxy
    at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
    at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
    at javax.faces.component.UIOutput.getValue(UIOutput.java:170)
    at javax.faces.component.UIInput.getValue(UIInput.java:284)
    at org.primefaces.util.ComponentUtils.getValueToRender(ComponentUtils.java:81)
    at org.primefaces.component.inputtext.InputTextRenderer.encodeMarkup(InputTextRenderer.java:71)
    at org.primefaces.component.inputtext.InputTextRenderer.encodeEnd(InputTextRenderer.java:52)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:881)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeDynamicBody(PanelGridRenderer.java:131)
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableBody(PanelGridRenderer.java:102)
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeTableLayout(PanelGridRenderer.java:65)
    at org.primefaces.component.panelgrid.PanelGridRenderer.encodeEnd(PanelGridRenderer.java:37)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:881)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1786)
    at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:851)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:439)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
    at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:286)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:957)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:620)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

This error message indicates that the property called filter was not found, but it is there as you can see below;

package br.com.vendelancha.controller;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;

import br.com.vendelancha.model.Noticia;
import br.com.vendelancha.repository.Noticias;
import br.com.vendelancha.repository.filter.NoticiaFilter;

@Named
@ViewScoped
public class PesquisaNoticiasBean implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Inject
    private Noticias noticias;

    private NoticiaFilter filtro;
    private List<Noticia> NoticiasFiltrados;

    public PesquisaNoticiasBean() {
        filtro = new NoticiaFilter();
        NoticiasFiltrados = new ArrayList<>();
    }

    public void pesquisar() {   
        NoticiasFiltrados = noticias.filtrados(filtro);
    }

    public List<Noticia> getNoticiasFiltrados() {
        return NoticiasFiltrados;
    }

    public NoticiaFilter getFiltro() {
        return filtro;
    }


}

How to solve this problem?

My website;

<ui:composition template="/WEB-INF/template/LayoutSystem.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    <ui:define name="titulo">Pesquisa de Noticias</ui:define>

    <ui:define name="corpo">
        <h:form>
            <h1>Pesquisa de Noticias</h1>

            <p:toolbar style="margin-top: 20px">
                <p:toolbarGroup>
                    <p:commandButton value="Pesquisa" action="#{pesquisaNoticiasBean.pesquisar}" update="@form" />
                </p:toolbarGroup>
                <p:toolbarGroup align="right">
                    <p:button value="Novo" outcome="/noticias/CadastroNoticias.xhtml" />
                </p:toolbarGroup>
            </p:toolbar>

            <p:panelGrid columns="2" id="painel"
                style="width: 100%; margin-top: 20px" columnClasses="rotulo, campo">

                <p:outputLabel value="Titulo" for="titulo" />
                <p:inputText id="titulo" size="20" value="#{cadastroNoticiaBean.filtro.titulo}" />



                <p:outputLabel value="Data de criação" />
                <h:panelGroup>
                    <p:calendar size="10" pattern="dd/MM/yyyy" />
                    a
                    <p:calendar size="10" pattern="dd/MM/yyyy" />
                </h:panelGroup>

            </p:panelGrid>



            <p:dataTable id="embarcacaoTable"
                value="#{pesquisaNoticiasBean.noticiasFiltrados}" var="embarcaoes"
                style="margin-top: 20px" emptyMessage="Nenhum notícia encontrada."
                rows="3" paginator="true" paginatorAlwaysVisible="false"
                paginatorPosition="bottom">

                <p:column headerText="Titulo" style=" text-align:center; width: 100px">
                    <h:outputText value="Lancha NX 250, da NX Boats – Lançamento" />
                </p:column>
                <p:column headerText="Data de criação"
                    style="text-align: center; width: 140px">
                    <h:outputText value="05/06/2013" />
                </p:column>

                <p:column headerText="Foto" style="text-align: center; width: 100px">
                    <h:outputText value="Nenhuma Imagem encontrada" />
                </p:column>

                <p:column style="width: 100px; text-align: center">
                    <p:button icon="ui-icon-pencil" title="Editar" />
                    <p:commandButton icon="ui-icon-trash" title="Excluir" />
                </p:column>
            </p:dataTable>
        </h:form>
    </ui:define>
</ui:composition>

take a look at the image;

inserir a descrição da imagem aqui

It was to be locating all the methods they received get.

  • 1

    What is the name of the method?

  • 1

    I apologize a thousand for posting, I actually spent the whole day working and I got home to work on the project, and ended up cheating myself, in fact the class I should put is the researchNoticiaBean instead of registering.

No answers

Browser other questions tagged

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