hiii i am using spring MVC and i have list which ia m sending as my response to jsp but ibn in this jsp i have a attribute isnew which is of type boolean so i want a comaprison on this attribute soo sode is
<core:forEach var="i" items="${loginsuccess}" >
<core:if test="${i.isNew eq true}">
<core:out value="${i.notofication}"></core:out> </br>
</core:if>
</core:forEach>
DAO CODE
@Autowired
SessionFactory usermanagementSessionFactory;
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");
mv.addObject("loginsuccess" ,list1);
return mv;
}
its not working please suggest me how can i resolve this problem
检查它是如何工作的。 我想只在新的时候显示通知,这是返回登录成功的dao代码,控制器只调用这个代码作为一个简单的方法
答案 0 :(得分:1)
这应该有效
<core:if test="${i.new}">
答案 1 :(得分:0)
你可以像这样使用
<c:choose>
<c:when test="${i.new}">
//to do statement
</c:when>
//to do statement
<otherwise>
</otherwise>
</c:choose>