首页 新闻 搜索 专区 学院

spring mvc后台将数据存放到session后返回jsp,但jsp的数据不显示,手动刷新后才显示

0
悬赏园豆:10 [已解决问题] 解决于 2016-04-13 13:43

手动点击刷新后才显示

js(index页面,一进去ready完后,进controller)

$(function(){
 var url = "<%=request.getContextPath()%>/announcement/selectIndexLimits";
    $.post(url);
});   

 

controller

     @RequestMapping("/selectIndexLimits")
     public String selectIndexLimits(HttpServletRequest request){
    
         List<Announcement> announcementIndex = announcementService.selectLimits(0,
                 5);
         request.getSession().setAttribute("announcementIndex", announcementIndex);
//         model.addAttribute("announcementIndex", announcementIndex);
         return "index";
     }

 

前台显示是el

<c:forEach items="${announcementIndex}" var="announcementIndex">
      <tr>
      <td><%=++annoi%></td>
      <td><a onclick='showAnnoContent(this)'>${announcementIndex.title }</a></td>
      <td hidden='hidden'>${announcementIndex.name }</td>
      <td hidden='hidden' class='annoContent'>${announcementIndex.content }</td>
      <td>${announcementIndex.time}</td>
     </tr>
</c:forEach>
胖胖的半山兄的主页 胖胖的半山兄 | 菜鸟二级 | 园豆:240
提问于:2016-04-10 16:27
< >
分享
最佳答案
0

已解决,后台跳转失效,但就算有效此方法也不可取。换了写法

胖胖的半山兄 | 菜鸟二级 |园豆:240 | 2016-04-10 18:30
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册