my dog learned polymorphism*
The moose likes JSP and the fly likes Display java.util.List returned by Hibernate in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Display java.util.List returned by Hibernate in JSP" Watch "Display java.util.List returned by Hibernate in JSP" New topic
Author

Display java.util.List returned by Hibernate in JSP

Chris Church
Greenhorn

Joined: Aug 01, 2007
Posts: 1
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

Joined: Feb 05, 2001
Posts: 17249
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Display java.util.List returned by Hibernate in JSP
 
Similar Threads
Iterating a List Using JSTL
Hibernate - How to retrieve data from the database
Problem with Count query having IN clause in Hibernate
Making Hibernate 5.0 Compliant
Convert Set to List