Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display java.util.List returned by Hibernate in JSP

 
Chris Church
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a java.util.List of simple objects (3 string properties only) returned by hibernate:

Query query = session.getNamedQuery("MyQuery");
return query.list();

What is the best way of displaying the results in a JSP.
I am struggling to find how to get the list to a <c:forEach loop.

Many thanks if anyone can help.

Chris
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to move this to the JSP forum, since it is a JSP question and not a Hibernate or ORM specific question.

Thanks

Mark
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you bind your list to a scope object (request, session, etc..), your JSTL forEach loop will be able to find it using an EL expression in the "items" attribute.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic