问题描述
<html><head><title>分页</title></head><body><tablewidth="778"border="0"cellPadding="0"cellSpacing="1"bgcolor="#6386d6"><trbgcolor="#EFF3F7"><TDalign="center">用户名</TD><TDalign="center">年龄</TD><TDalign="center">国籍</TD><TDalign="center">性别</TD><TDalign="center">相关操作</TD></tr><c:iftest="${!emptypm.datas}"><c:forEachitems="${pm.datas}"var="user"><trbgcolor="#EFF3F7"><tdalign="center">${user.sname}</td><tdalign="center">${user.age}</td><tdalign="center">${user.native_}</td><tdalign="center">${user.sex}</td><tdalign="center">修改 删除</td></tr></c:forEach></c:if><c:iftest="${emptypm.datas}"><tr><tdcolspan="5"align="center"bgcolor="#EFF3F7">没有找到相应的记录</td></tr></c:if></table><pg:pagerurl="stu.do"items="${pm.total}"export="currentPageNumber=pageNumber"maxPageItems="10"><pg:first><ahref="${pageUrl}">首页</a></pg:first><pg:prev><ahref="${pageUrl}">上一页</a></pg:prev><pg:pages><c:choose><c:whentest="${currentPageNumbereqpageNumber}"><fontcolor="red">${pageNumber}</font></c:when><c:otherwise><ahref="${pageUrl}">${pageNumber}</a></c:otherwise></c:choose></pg:pages><pg:next><ahref="${pageUrl}">下一页</a></pg:next><pg:last><ahref="${pageUrl}">尾页</a></pg:last></pg:pager></body></html>--------------------------------------<struts-config><form-beans><form-beanname="userForm"type="com.dengmin.pager.forms.UserActionForm"/></form-beans><action-mappings><actionpath="/userManager"type="org.springframework.web.struts.DelegatingActionProxy"name="userForm"scope="request"parameter="method"><forwardname="success"path="/UserManager.jsp"/></action></action-mappings>-----------------------------------------------------------------publicclassStuActionextendsDispatchAction{privateStudentBizsbiz;publicvoidsetSbiz(StudentBizsbiz){this.sbiz=sbiz;}publicActionForwardfind(ActionMappingmapping,ActionFormform,HttpServletRequestrequest,HttpServletResponseresponse){StudentFormstudentForm=(StudentForm)form;//TODOAuto-generatedmethodstubintoffset=0;try{offset=Integer.parseInt(request.getParameter("pager.offset"));}catch(Exceptione){}PageModelpm=sbiz.FinfAllStu(offset,10);request.setAttribute("pm",pm);returnmapping.findForward("goto");}--------------------------------------------------------------------------------当点击下一页的时候我报这个错误这不到parameter严重:Servlet.service()forservletactionthrewexceptionjavax.servlet.ServletException:Request[/stu]doesnotcontainhandlerparameternamed's'.Thismaybecausedbywhitespaceinthelabeltext.atorg.apache.struts.actions.DispatchAction.unspecified(DispatchAction.java:215)atorg.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:249)atorg.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)atorg.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)atorg.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)atorg.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)atorg.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)atorg.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:617)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:717)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)atjava.lang.Thread.run(UnknownSource)
解决方案
解决方案二:
<pg:pagerurl="stu.do"items="${pm.total}"export="currentPageNumber=pageNumber"maxPageItems="10"><pg:pagerurl="stu.do?method=find"items="${pm.total}"export="currentPageNumber=pageNumber"maxPageItems="10">
解决方案三:
我试了一下1楼的方法还是不对啊!报这么个错就是他找不到action中的这个方法-----------------------------------------------------------------------严重:Servlet.service()forservletactionthrewexceptionjava.lang.NoSuchMethodException:Action[/stu]doesnotcontainspecifiedmethod(checklogs)atorg.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:264)atorg.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)atorg.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)atorg.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)atorg.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)atorg.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)atorg.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:617)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:717)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atcom.web.filter.Filter.doFilter(Filter.java:22)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)atjava.lang.Thread.run(UnknownSource)
解决方案四:
终于解决了要吧action中的find方法名改成unspecified默认方法名