0
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 代码,控制器仅将此代码作为简单方法调用

4

2 回答 2

1

这应该工作

<core:if test="${i.new}"> 
于 2013-10-05T11:41:04.583 回答
0

你可以这样使用

<c:choose>

   <c:when test="${i.new}"> 
//to do statement
   </c:when>
//to do statement
   <otherwise>

   </otherwise>
</c:choose>
于 2013-10-05T20:55:36.740 回答