Hii i am running a named query and in my table i have multiple notifications for a corresponding userid so i need to get these multiple notification in a list and then show on my jsp
here is my code..
JAVA CODE
public ModelAndView getNotifications(int id){
System.out.println("Method ios called");
Session session = usermanagementSessionFactory.openSession();
System.out.println("after Getting Session");
int id1 = id;
System.out.println(id1);
Query query=(Query) session.getNamedQuery("getNotification");
query.setInteger("userId",id1);
List<Message> list1= query.list();
ModelAndView mv = new ModelAndView("notifications");
for(Message userData:list1)
{
String notifications=userData.getNotification();
boolean isNew=(boolean) userData.isNew();
ArrayList li = new ArrayList();
li.add(notifications);
//li.add(mname1);
if(isNew)
{
mv.addObject("loginsuccess" ,li);
}else
{
mv.addObject("loginsuccess" ,"There is no New Notifications");
}
}
return mv;
}
JSP FILE
<h3 style="margin-top:100px;"> <core:forEach items="${loginsuccess}" var="items">
<core:out value="${items}"></core:out>
</core:forEach>
機能していません テーブルの最後のエントリのみが表示されますする必要がある、リストがすべてのレコードを取得する方法、どのような変更が必要か