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 01:28:01 GMT
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!
> 
> I'm running into some problems getting the
> logic:iterate tag to work.
> 
> I have a class who's full name is
> org.ellism.tir.util.DatabaseConstantsAdapter.  It
> has
> a public method, getInstance() that returns an
> instance of itself (The class itself is a
> singleton). 
> This class has a method getProductLines() that
> returns
> an ArrayList full of
> org.ellis.tir.util.ProductLineToken objects.  I'd
> like
> to iterate over this collection and print some stuff
> out.
> 
> I've tried this:
> 
> <%@ taglib uri="/WEB-INF/struts-html.tld"
> prefix="html" %>
> <%@ taglib uri="/WEB-INF/struts-bean.tld"
> prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld"
> prefix="logic" %>
> 
> ...Lots of HTML code...
> 
> <logic:iterate id="productLine" collection="<%
>
org.ellism.tir.util.DatabaseConstantsAdapter.getInstance().getProductLines();
> %>">
> The name is: <bean:write name="productLine"
> property="name"/>.
> </logic:iterate>
> 
> However this doesn't seem to work, I get this error:
> 
> org.apache.jasper.JasperException: Cannot create
> iterator for this collection
> ..Stack Trace
> 
> I'm not sure why this happens?  The object returned
> by
>
org.ellism.tir.util.DatabaseConstantsAdapter.getInstance().getProductLines()
> is of type ArrayList, and I thought that was a valid
> collection to iterate over?
> 
> Any insights would be wonderful.
> 
> Cheers!
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> struts-user-help@jakarta.apache.org
>  

_________________________________________________________
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