spring 查询后分页时要将查询的ModelAttribute=activity这个存储很多对象的数据在链接中怎么传一个这样的对象啊

wenwen1 发布于 2013/01/09 15:20
阅读 394
收藏 0

收藏!数据建模最全知识体系解读!>>>

查询框的form是这么写的: 

<form:form action="${pageContext.request.contextPath}/selectAllActivity?currpage=1" method="POST" ModelAttribute="activity">
             <table cellpadding="0"  cellspacing="0" id="viewTable" >
              <tbody><tr>
               <td class="label" valign="top"><fmt:message key="activity.project.title"/></td>
               <td><!--项目输入框(使用memo作为存放路径)-->    
             <form:input id="activity_project" path="memo" cssStyle="width:400px;"/>
               </td><td class="label" valign="top"><fmt:message key="activity.creater.title"/></td>
               <td><!--项目输入框(使用memo作为存放路径)-->    
             <form:select id="activity_creater" path="userByCreater.id" cssStyle="width:400px;">
             <form:option value="0" label=""></form:option>
             <form:options items="${users}"/>
             </form:select>
               </td>
               <td>
                <input  id="save" type="submit" value="<fmt:message key="navigation.view"/>"/>
             <script type="text/javascript">Spring.addDecoration(new Spring.ValidateAllDecoration({elementId:'save', event:'onclick'}));</script>
               </td><td>
                <a href="${pageContext.request.contextPath}/allActivity?currpage=1" target="_self"><input type="button" value="<fmt:message key="navigation.nosearch"/>" /></a> </td>
              </tr></tbody>
             </table>
            </form:form>

在页面上的分页是这么写的:

<a href="${pageContext.request.contextPath}/selectAllActivity?currpage=${pageModel.firstPage}& activity=${activity}" target="_self"><fmt:message key="firstpage.title"/></a>       
  <a href="${pageContext.request.contextPath}/selectAllActivity?currpage=${pageModel.previousPage}& activity=${activity}" target="_self"><fmt:message key="previouspage.title"/></a>
  <a href="${pageContext.request.contextPath}/selectAllActivity?currpage=${pageModel.nextPage}&activity=${activity}" target="_self"><fmt:message key="nextpage.title"/></a>
  <a href="${pageContext.request.contextPath}/selectAllActivity?currpage=${pageModel.lastPage}&activity=${activity}" target="_self"><fmt:message key="lastpage.title"/></a>      

后台是这么写的:@RequestMapping("/selectAllActivity")
 public ModelAndView selectAllActivity(@ModelAttribute Activity activity,@RequestParam Integer currpage)
 {
  ModelAndView mav=new ModelAndView();
  int pageSize=20;
  int totalRecords=queryManageService.actQueryTotalRecord(activity);
  mav.addObject("pageModel", workSpaceService.getPage(pageSize, currpage, totalRecords));
  mav.addObject("users", shareService.getUsersMap());
  mav.addObject("page", currpage);
  mav.addObject("activity", activity);
  mav.addObject("totalRecords", totalRecords);
  mav.addObject("activities", queryManageService.findActivitiesByQuery(activity, currpage-1, pageSize));
  mav.setViewName("query/allActivity.jsp");
  return mav;
 }

请问怎么将一个ModelAttribute里面的值传送到后台去?下面的代码怎么改?href="${pageContext.request.contextPath}/selectAllActivity?currpage=${pageModel.firstPage}&activity=${activity}" 

 

加载中
0
白黑白
白黑白
post提交表单,form里加一个隐藏<input  type="hidden" name="",value=""/ >用这个传值
白黑白
白黑白
貌似不行,就算行估计项目真正运行时也不够看
wenwen1
wenwen1
不是表单,是说查完之后的分页怎么把以前查询过的数据传到下一页啊
返回顶部
顶部