Retrieve PDF from the Database and display it on the screen

0

I have a WEB application, using JSF and Primefaces and MYSQL. It has a product registration screen and in it I need to select a PDF, I was able to attach this PDF and an "insert" in the Bank as "BLOB", but at the time of listing, I can not.

I need to give a select in this table and show the PDF to the client, but I can not.

ProductDAO

    StringBuilder sql = new StringBuilder();
    sql.append("SELECT idProcesso, Processo");
    sql.append(" FROM processos ");
    sql.append(" ORDER BY idProcesso ASC");

    Connection conexao = ConexaoFactory.conectar();

    PreparedStatement comando = conexao.prepareStatement(sql.toString());

    ResultSet resultado = comando.executeQuery();

    ArrayList<Processos> lista = new ArrayList<Processos>();

    while (resultado.next()) {

        Processos item = new Processos();
        item.setArquivo("select no campo PDF,");
        item.setIdProcessos(resultado.getInt("idProcesso"));

        lista.add(item);
    }

    return lista;
}

Process.xhtml

            <p:column headerText="Processo do Cliente">

                <p:outputPanel id="read">
                    <p:media value="#{item.arquivo}" player="pdf" /> >
                </p:outputPanel>
            </p:column>
    
asked by anonymous 05.09.2018 / 19:21

0 answers