jsp页面遍历后台传递的对象

(1)单个对象app

    后台代码    spa

@RequestMapping(value = {"demos"})
public String demos(int noteId, Model model,String algorithmId) {
   Demo demo = Dem.get(noteId);
   model.addAttribute("demo", demo);
   return "modules/demos/demosForm";
}

页面代码orm

<table class="new-pad">
   <th  class="sort-column needBy">姓名</th>
   <th  class="sort-column needBy">需求者</th>
   <th  class="sort-column createDate">发布时间</th>
   <th  class="sort-column content">需求内容</th>

   <tr>
      <td>
         ${demo.algorithName}
      </td>
      <td>${demo.needBy}</td>
      <td>
         <fmt:formatDate value="${demo.createDate}" pattern="yyyy-MM-dd "/>
      </td>
      <td>
         ${demo.needContent}
      </td>
   </tr>

</table>

 

 

(2)多个对象(list)对象

后台代码get

@RequestMapping(value = {"list", ""})
public String list(Demo demo, HttpServletRequest request, HttpServletResponse response, Model model) {
   Page<Demo> page = demoService.findPage(new Page<Demo>(request, response), demo);
   model.addAttribute("page", page);
   return "modules/demo/demoList";
}

 

页面代码it

<table class="new-pad">
   <th  class="sort-column needBy">姓名</th>
   <th  class="sort-column needBy">需求者</th>
   <th  class="sort-column createDate">发布时间</th>
   <th  class="sort-column content">需求内容</th>
   <c:forEach items="${page .demo}" var="demo">
   <tr>
      <td>
         ${demo.algorithName}
      </td>
      <td>${demo.needBy}</td>
      <td>
         <fmt:formatDate value="${demo.createDate}" pattern="yyyy-MM-dd "/>
      </td>
      <td>
         ${demo.needContent}
      </td>
   </tr>
   </c:forEach>
</table>
相关文章
相关标签/搜索