Creative crypter Creative crypter - 6 months ago 34
SQL Question

Spring hibernate mvc - loop in frontend

I created a web application based on spring 4.3 and hibernate 5.2,

when it comes to querying for data and display data in frontend(jsp), i get stuck...


public ModelAndView helloWorld() {

List<Article> articles = articleDao.list();

ModelAndView model = new ModelAndView("test");

model.addObject("articles", articles);

return model;



<c:forEach var="article" items="${articles}">
${} <br/>

i have four records in database and this is displayed in frontend:

<c:foreach items="[,,,]" var="article">

When i log hibernate sql statement using log4j2, i get this output:

select as id1_0_, as name2_0_,
s_articles article0_

Anybody can help with this issue?
For now i just want to query for data from my database(articles) and display them on frontend (.jsp-pages).

Thanks and Greetings!!


Have you added

<%@ taglib uri="" prefix="c" %>

to your file ?

I think You will have to add the JSTL for using c:forEach, doing this should fix your issue.