October 24, 2024
Chicago 12, Melborne City, USA
java

The ArrayList of select MySQL DB that returned is don't show in JSP table


I’ve an method to select records in an mysql table this method are work fine but when I’ll load the returned records in my jsp table the records is not showed in the table.
My JSP code:

<table class="tabela" id="tabpacientes">
                <thead>
                    <tr>
                        <tr id="linha">
                        <th id="lcabeca" style="width: 50px">Hora</th>
                        <th id="lcabeca" style="width: 175px">Nome</th>
                        <th id="lcabeca" style="width: 34px">Sexo</th>
                        <th id="lcabeca" style="width: 70px">Data</th>
                        <th id="lcabeca" style="width: 70px">Telefone</th>
                    </tr>
                    </tr>
                </thead>
                <tbody id="tcorpo">                        
                <%
                    PacientesDAO_W01 pcdaopsqz = new PacientesDAO_W01();
                
                    Logger logger = Logger.getLogger(this.getClass().getName());
                    String cnpj = session.getAttribute("cnpj").toString();
                    System.out.println("Pegando cnpj setado: " + cnpj);

                ArrayList<PesquisaExamesDia> pacientes = new ArrayList<PesquisaExamesDia>();
             
                    String CNPJ = session.getAttribute("cnpj").toString();
                    String dtaExames = "18/10/2024";
                    logger.info("pstm data ultra. recebido: " + dtaExames);

                    pacientes = pcdaopsqz.getPesquisaExamesDia(cnpj, dtaExames);
                    logger.info("Tabela retornada para JSP: " + pacientes);
                    request.setAttribute("pacientes", pacientes);
                %>
                    <c:forEach var="tabpacientes" items="${pacientes}">
                        <tr id="linha">
                            <td id="lcoluna" style="width: 50px;"><c:out value="${tabpacientes.horaexame}"></c:out></td>
                            <td id="lcoluna" style="width: 175px;"><c:out value="${tabpacientes.nome}"></c:out></td>
                            <td id="lcoluna" style="width: 34px;"><c:out value="${tabpacientes.sexo}"></c:out></td>
                            <td id="lcoluna" style="width: 70px;"><c:out value="${tabpacientes.dataexame()}"></c:out></td>
                            <td id="lcoluna" style="width: 90px;"><c:out value="${tabpacientes.celular()}"></c:out></td>
                        </tr>
                    </c:forEach>            
                </tbody>
            </table>

This cod below is the "view frame source" result executed in my browser.

<table class="tabela" id="tabpacientes">
                <thead>
                    <tr>
                        <tr id="linha">
                        <th id="lcabeca" style="width: 50px">Hora</th>
                        <th id="lcabeca" style="width: 175px">Nome</th>
                        <th id="lcabeca" style="width: 34px">Sexo</th>
                        <th id="lcabeca" style="width: 70px">Data</th>
                        <th id="lcabeca" style="width: 70px">Telefone</th>
                    </tr>
                    </tr>
                </thead>
                <tbody id="tcorpo">                        
                
                    <c:forEach var="tabpacientes" items="[PesquisaExamesDia{cnpj=null, nome=Daniele dos Santos, prontuario=null, sexo=F, dataexame=18/10/2024, celular=(99)99999-9999, horaexame=10:00:00}, PesquisaExamesDia{cnpj=null, nome=Juscylene da Silva, prontuario=null, sexo=F, dataexame=18/10/2024, celular=(99)99999-9999, horaexame=08:30:00}]">
                        <tr id="linha">
                            <td id="lcoluna" style="width: 50px;"><c:out value=""></c:out></td>
                            <td id="lcoluna" style="width: 175px;"><c:out value=""></c:out></td>
                            <td id="lcoluna" style="width: 34px;"><c:out value=""></c:out></td>
                            <td id="lcoluna" style="width: 70px;"><c:out value=""></c:out></td>
                            <td id="lcoluna" style="width: 90px;"><c:out value=""></c:out></td>
                        </tr>
                    </c:forEach>            
                </tbody>
            </table>

As you can see the itens var of forEach tag has the result of select mysql db.
I don’t have any idea how to solve this because I’ve other tables into express language that work fine.
Thanks and best regards in advance.



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video