页面访问时发生错误:
Index: 0, Size: 0
java.lang.IndexOutOfBoundsException:Index: 0, Size: 0
atjava.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
atorg.hibernate.collection.PersistentBag.get(PersistentBag.java:423)
atorg.eline.web.dis.StationiAction.list(StationiAction.java:478)
atsun.reflect.GeneratedMethodAccessor243.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
atjava.lang.reflect.Method.invoke(Method.java:597)
atcom.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
atcom.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
atorg.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atorg.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atorg.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
atcom.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atcom.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atorg.apache.struts2.interceptor.MessageStoreInterceptor.intercept(MessageStoreInterceptor.java:204)
atcom.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
atorg.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
atorg.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
atorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
atorg.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
atorg.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
atorg.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:378)
atorg.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:99)
atorg.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
atorg.springframework.security.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.ui.SessionFixationProtectionFilter.doFilterHttp(SessionFixationProtectionFilter.java:67)
atorg.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.ui.ExceptionTranslationFilter.doFilterHttp(ExceptionTranslationFilter.java:101)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.providers.anonymous.AnonymousProcessingFilter.doFilterHttp(AnonymousProcessingFilter.java:105)
atorg.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.rememberme.RememberMeProcessingFilter.doFilterHttp(RememberMeProcessingFilter.java:109)
atorg.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.wrapper.SecurityContextHolderAwareRequestFilter.doFilterHttp(SecurityContextHolderAwareRequestFilter.java:91)
at org.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.ui.basicauth.BasicProcessingFilter.doFilterHttp(BasicProcessingFilter.java:174)
atorg.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:277)
atorg.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.ui.logout.LogoutFilter.doFilterHttp(LogoutFilter.java:89)
atorg.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.context.HttpSessionContextIntegrationFilter.doFilterHttp(HttpSessionContextIntegrationFilter.java:235)
atorg.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.concurrent.ConcurrentSessionFilter.doFilterHttp(ConcurrentSessionFilter.java:99)
atorg.springframework.security.ui.SpringSecurityFilter.doFilter(SpringSecurityFilter.java:53)
atorg.springframework.security.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:390)
atorg.springframework.security.util.FilterChainProxy.doFilter(FilterChainProxy.java:175)
atorg.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:236)
atorg.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
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)
at org.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)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
atorg.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:864)
atorg.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
at java.lang.Thread.run(Thread.java:662)
问题后果:
导致分页不可用,且点分页下一页、上一页等报错(Index: 0, Size: 0
)
解决:
把下列红色的注释掉即可
StationiAction.java:
public String list() throws Exception {
// List
// request.setAttribute("stationList",stationList);
// Long count =staposchangeManager.queryStaposchangeGsn("5480011708");
// p(count);
// request.setAttribute("count", count);
p(page.getPageSize());
p(page.getPageNo() + "-----------");
p(page.getTotalCount());
page=stationManager.list(page);
p("***********"+page.getResult());
p("***********"+page.getResult().get(0));
//.get(0).getPoschanges().get(0).getGsn()
// p("***********"+page.getResult().get(0).getPoschanges());
// p("***********"+page.getResult().get(0).getPoschanges().get(0));
// p("***********"+page.getResult().get(0).getPoschanges().get(0).getGsn());
// p(page.getTotalCount());//-1
// p(page.getPageNo());//1
// p(page.getTotalPages());//1
this.request.setAttribute("page",page);
return "station-info";
}