Difficulty in visualizing data in a web project VRaptor

0

Check how my JSP page is

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Insert title here</title>
</head>
<body>


    <table>
        <thead>
            <tr>
                <th>Nome</th>
                <th>Descrição</th>
                <th>Preço</th>
            </tr>
        </thead>
        <tbody>
            <c:forEach items="${produtoList}" var="produto">
                <tr>
                    <td>${produto.nome }</td>
                    <td>${produto.descricao }</td>
                    <td>${produto.preco }</td>
                </tr>
            </c:forEach>
        </tbody>
    </table>

</body>
</html>

See how my page was

It was like you will come, nothing appears. My web project is correctly configured for VRaptor, but I think the problem is in these two files below;

ProductDao and the ProductsController

package br.com.fj28.dao;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.Transaction;

import br.com.caelum.vraptor.ioc.Component;
import br.com.fj28.infra.CriadorDeSession;
import br.com.fj28.modelo.Produto;

@Component
public class ProdutoDao {

    private final Session session;

    public ProdutoDao() {
        this.session = CriadorDeSession.getSession();
    }

    public void salva(Produto produto) {

        Transaction tx = session.beginTransaction();
        session.save(produto);
        tx.commit();
    }


    public List<Produto> listaTudo(){
        return this.session.createCriteria(Produto.class).list();
    }

}

/////////////////////////////////////////////// ////////

package br.com.fj28.controller;

import java.util.List;

import br.com.caelum.vraptor.Resource;
import br.com.fj28.dao.ProdutoDao;
import br.com.fj28.modelo.Produto;

@Resource
public class ProdutosController {

    private final ProdutoDao dao;

    public ProdutosController(ProdutoDao dao){
        this.dao = dao;

    }

    public List<Produto> lista(){
        return dao.listaTudo();
    }

}

Could someone give me a hint to solve the problem?

I am confirming that there are records in the Mysql database.

    
asked by anonymous 22.03.2015 / 17:49

1 answer

1

Apparently you forgot to import the JSTL tag lib, like this:

<%@ taglib prefix="c"% uri="http://java.sun.com/jsp/jstl/core">
<%@ taglib prefix="fmt"% uri="http://java.sun.com/jsp/jstl/fmt">

PSC: fmt - > if you need formatting

    
10.11.2017 / 03:53