@PostConstruct is not accessible

0

Good night, I'm using javax.faces-2.2.9 and the @PostConstruct annotation does not appear, what can it be?

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    template="/templates/modeloSistema.xhtml">

    <ui:define name="menu">
        <ui:include src="/includes/menuPrincipal.xhtml" />
    </ui:define>

    <ui:define name="conteudo">
        <h:form>
            <p:dataTable emptyMessage="Nenhum Registro encontrado!" 
                value="#{MBFabricante.fabricantes}" var="fabricante">
                <p:column headerText="Codigo">
                    <p:outputLabel value="#{fabricante.codigo}"/>
                </p:column>

                <p:column headerText="Descrição">
                    <p:outputLabel value="#{fabricante.descricao}"/>
                </p:column>
            </p:dataTable>
        </h:form>
    </ui:define>

</ui:composition>

package br.com.drogaria.bean;

import java.sql.SQLException;
import java.util.ArrayList;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.ListDataModel;

import br.com.drogaria.dao.FabricanteDAO;
import br.com.drogaria.domain.Fabricante;

@ManagedBean(name = "MBFabricante")
@ViewScoped
public class FabricanteBean {

    private ListDataModel<Fabricante> fabricantes;

    public ListDataModel<Fabricante> getFabricantes() {
        return fabricantes;
    }

    public void setFabricantes(ListDataModel<Fabricante> fabricantes) {
        this.fabricantes = fabricantes;
    }

    **//@PostConstruct**
    public void preparaPesquisa() {
        try {
            FabricanteDAO fdao = new FabricanteDAO();
            ArrayList<Fabricante> lista = fdao.listar();
            fabricantes = new ListDataModel<Fabricante>(lista);
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
}

This comment is not appearing

    
asked by anonymous 11.12.2018 / 01:30

0 answers