@Cristiano_Gomes escreveu:
Boa tarde, estou tentando exibir uma lista pelo jsp, tentei chamar do servlet e do managerBean e nao consegui, alguem me socorre..rsrsrs.
Chamando do ManagerBean
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@page import="entity.*, persistence.*"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <jsp:useBean id="mb" class="manager.ManagerBean" scope="request"/> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Times</title> </head> <body> <table border=1 > <tr> <th> Codigo </th> <th> Nome </th> <th> Email</th> <th> Sexo</th> <th> Nascimento</th> <th> Time</th> </tr> <c:forEach items="${mb.torcedores }" var="linha"> <tr> <td> ${linha.idTorcedor}</td> <td> ${linha.nome}</td> <td> ${linha.email}</td> <td> ${linha.sexo}</td> <td> ${linha.dataNascimento}</td> <td> ${linha.time}</td> </tr> </c:forEach> </table> ${msg} </body> </html>
ManagerBean
package manager; import java.util.List; import entity.Torcedor; import persistence.TorcedorDao; public class ManagerBean { private List<Torcedor>torcedores; public ManagerBean() { // TODO Auto-generated constructor stub } public List<Torcedor> getTorcedores() { try{ TorcedorDao td = new TorcedorDao(); torcedores = td.findAll(); }catch(Exception e){ } return torcedores; } public void setTorcedores(List<Torcedor> torcedores) { this.torcedores = torcedores; } }
Mensagens: 7
Participantes: 3