struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guo yingshou <guoyings...@yahoo.com.cn>
Subject Re: logic:iterate problems
Date Tue, 17 Jun 2003 14:51:35 GMT
If i were you, i would check like this in my jsp:


<%@ page import="java.util.Collection" %>
<%@ page import="java.util.Iterator" %>

....

<%
  Collection c = ...getProductLines();
  Iterator it = c.iterator();
   out.print(it);  
%>

do not <logic:iterate> yet util the above code run
ok.And then you can be sure that the previous
<logic:iterate> should run with no problem.

the <logic:iterate> tag handler will always try to
retrieve the object from one of the 4 scopes ie.
page,request,session,application that you placed
sometime before.








 --- Matt E <mgeusenet@yahoo.com> 的正文:> Hello!
> 
> I tried that (I found I needed to change Collection
> c
> to java.util.Collection c, so the compiler would not
> complain) but I'm still experiancing the same
> problem:
> 
> org.apache.jasper.JasperException: Cannot create
> iterator for this collection
> 
> I added some print statements to help me debug, and
> I
> know that the getProductLines() method is being
> called, so this *should* be working.  I'm at a loss.
> 
> Here's the full stack trace if it will help anyone.
> 
> Thanks in advance for any insight anyone has.
> 
> Cheers!
> 
> org.apache.jasper.JasperException: Cannot create
> iterator for this collection
> 	at
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
> 	at
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> 	at
>
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> 	at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
> 	at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
>
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
> 	at
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> 	at
>
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
> 	at
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
>
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
> 	at
>
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
> 	at
>
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
> 	at
>
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
> 	at
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
> 	at java.lang.Thread.run(Thread.java:536)
> 
> 
> root cause 
> 
> javax.servlet.ServletException: Cannot create
> iterator
> for this collection
> 	at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
> 	at
>
org.apache.jsp.toolDevelopmentRequest_jsp._jspService(toolDevelopmentRequest_jsp.java:147)
> 	at
>
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
> 	at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	at
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
> 	at
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> 	at
>
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> 	at
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
> 	at
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
> 	at
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
>
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
> 	at
>
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> 	at
>
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
> 	at
>
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
>
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
> 	at
>
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
> 	at
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
> 	at
>
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
> 	at
>
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
> 	at
>
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
> 	at
>
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
> 	at
>
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
> 	at
>
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
> 	at java.lang.Thread.run(Thread.java:536)
> 
> 
> 
> 
> --- guo yingshou <guoyingshou@yahoo.com.cn> wrote:
> > try something like:
> > 
> > <%
> >   Collection c =
> >
>
org.ellism.tir.util.DatabaseConstantsAdapter.getInstance().getProductLines();
> > 
> >   request.setAttribute("colName",c);
> > %>
> > 
> > and then:
> > 
> > <logic:iterate id="..." collection="colName"...
> > 
> > </logic:iterate>
> > 
> > you can alse put your collection into the jsp
> scope
> > variable somewhere in your action.
> > 
> > hope it helps.
> > 
> > guo
> > 
> >  --- Matt E <mgeusenet@yahoo.com> 的正文:> Hello
> > All!
> > > 
> 
=== message truncated === 

_________________________________________________________
Do You Yahoo!? 
流连网络世界的“你”是谁?
http://cn.rd.yahoo.com/mail_cn/tag/?http://cn.surveys.yahoo.com/cn_user_profile_study_may2003

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message