Your HQL query returns List<Object[]> , you can change the method signature to
public List<Object[]> getAnalyticsbyid(String userId)
And in the place where this method is called, iterates over the list and prints the details
List<Object[]> list = getAnalyticsbyid("user"); for (Object[] objects : list) { for (Object object : objects) { System.out.print(object); System.out.print("\t"); } System.out.println(); }
If you want to display it as a table in the jsp file, start with the following snippet
<table> <tr> <th>bounces</th> <th>visits</th> <th>landingPagePath</th> </tr> <c:forEach items="${analytics}" var="objects"> <tr> <c:forEach items="${objects}" var="object"> <td><c:out value="${object}"/></td> </c:forEach> </tr> </c:forEach> </table>
source share