Erro_JSP / BEAN

1 resposta
V

Gente,
Estou com um problema de um erro na JSP, que não sei como resolver. Estou pegando o get dos atributos, mas dá o seguinte erro:
- Property 'nome' not found on type java.lang.String

BEAN
public class Disciplina   
{  
        private String id;  
    private String nome;  
      
    public Disciplina()  
    {  
        super();  
    }  
  
    public String getId()   
    {  
        return id;  
    }  
      
    public void setId(String id)   
    {  
        this.id = id;  
    }  
      
    public String getNome()   
    {  
        return nome;  
    }  
      
    public void setNome(String nome)   
    {  
        this.nome = nome;  
    }
JSP
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>  
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
  
<!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>Insert title here</title>  
</head>  
  
<body>  
    <jsp:useBean id="disciplina" class="Entidade.Disciplina" scope="request">  
      
    <table>  
        <c:forEach var="listagem" items="{disciplina}">  
            <tr>  
                <td> <c:out value="${listagem.nome}" /></td>  
                <td> <c:out value="${listagem.id}" /></td>  
            </tr>  
        </c:forEach>  
    </table>            
  
    <script> alert("oiii");</script>  
    </jsp:useBean>  
</body>  
</html>

Abs,

1 Resposta

rogelgarcia

Remove esse trecho para ver se funciona:

<tr>    
                <td> <c:out value="${listagem.nome}" /></td>    
                <td> <c:out value="${listagem.id}" /></td>    
            </tr>

E coloque esse no lugar:

<tr>    
                <td> <c:out value="${listagem}" /></td>    <td></td>
            </tr>
Criado 19 de junho de 2011
Ultima resposta 19 de jun. de 2011
Respostas 1
Participantes 2