Results 1 to 2 of 2

Thread: ModelAndView.addObject("","") and JSTL

  1. #1
    Join Date
    May 2008
    Posts
    11

    Default ModelAndView.addObject("","") and JSTL

    Hi am running in to a problem where I have dynamically created menu list created based on server data set on the controller through:
    ModelAndView.addObject("mydataList",data)

    on my JSP I abstract the data using JSTL as such:
    <c:forEach var="menuItem" items="${mydataList}">
    ...print the menus....
    </c:forEach>
    ...
    make Ajax call every 1 minute to get menu list again and recreate the menus.
    ...

    The problem is that on the controller side, where I am adding the object, the correct values are added to the Model but on the JSP side, it keeps printing the old values from the first time (when page loaded). I am calling ModelAndView.clear() to make sure there is nothing before adding object to Model, but I don't know why the JSP keeps pulling old values.

    Any suggestions are greatly appreciated.
    --

  2. #2
    Join Date
    Oct 2008
    Location
    Delhi, India
    Posts
    163

    Default

    This might be a caching problem. I faced something similar too but only on IE because IE kept caching my pages while FF didn't. Try testing your page on FF and see if it works. Adding cache-control to your page should work either way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •