True, you could get around that by putting the Collection returned by values on the request, what you probably want to do is look at this though:
http://jakarta.apache.org/struts/userGuide/struts-logic.html#iterate in particular: However, if you iterate over a Map, the exposed object is of type Map.Entry that has two properties: * key - The key under which this item is stored in the underlying Map. * value - The value that corresponds to this key. -----Original Message----- From: Derek Shen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 05, 2003 1:27 PM To: [EMAIL PROTECTED] Subject: RE: how to access a specific object inside a List efficiently Because there's no getter method for the values. To iterate through the values of a map: <logic:iterate id="row" name="map" property="???"> If there's getValues() method, "values" can be put as the property. >From: "John Espey" <[EMAIL PROTECTED]> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >Subject: RE: how to access a specific object inside a List efficiently >Date: Wed, 5 Feb 2003 13:13:27 -0600 > >what's wrong with the values() method? > >-----Original Message----- >From: Derek Shen [mailto:[EMAIL PROTECTED]] >Sent: Wednesday, February 05, 2003 1:06 PM >To: [EMAIL PROTECTED] >Subject: RE: how to access a specific object inside a List efficiently > > >How to iterate through the values of a Map? > >There's no getValues() method in Map. > >Thanks! > > >From: "Derek Shen" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: RE: how to access a specific object inside a List efficiently > >Date: Wed, 05 Feb 2003 18:49:23 +0000 > > > >Thanks guys! I am trying to use TreeMap now. > > > >>From: [EMAIL PROTECTED] > >>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >>To: [EMAIL PROTECTED] > >>Subject: RE: how to access a specific object inside a List efficiently > >>Date: Wed, 5 Feb 2003 13:07:54 -0500 > >> > >>TreeMap should solve the problem, sorted + quick-lookup. > >> > >>Regards, > >> > >> > >>PQ > >> > >>"This Guy Thinks He Knows Everything" > >>"This Guy Thinks He Knows What He Is Doing" > >> > >>-----Original Message----- > >>From: Rob Kischuk [mailto:[EMAIL PROTECTED]] > >>Sent: February 5, 2003 12:57 PM > >>To: 'Struts Users Mailing List' > >>Subject: RE: how to access a specific object inside a List efficiently > >> > >>The problem you're hitting is that there's really no concept of a "key" >in > >>a > >>List - it's just an ordered collection of objects. The closest you'd >find > >>is the contains( Object o) method, but that looks for the entire object > >>and > >>not just a key. I would suggest using a HashMap for what you're looking > >>for. > >> > >>As for the "break" on logic:iterate, I think the closest way to > >>approximate > >>this is by setting up a flag for the loop such that you can do this: > >> > >><set up loop flag> > >><logic:iterate....> > >> <logic:equals name="loopFlag" value="true"> > >> (do important stuff) > >> </logic:equals> > >> < set loopFlag to false when criteria are met> > >></logic:iterate> > >> > >>This won't save the loop iterations, but will keep extra content from > >>being > >>written after you meet the criteria. If possible, however, you may want > >>to > >>trim your data set in the Action before you ever get to the jsp. > >> > >>-Rob > >> > >>-----Original Message----- > >>From: Derek Shen [mailto:[EMAIL PROTECTED]] > >>Sent: Wednesday, February 05, 2003 12:51 PM > >>To: [EMAIL PROTECTED] > >>Subject: how to acccess a specific object inside a List efficiently > >> > >> > >>I have trouble to access a specific object inside a List based on a key. > >>Before the first page, I load all the objects(meetings) into a list and > >>only > >> > >>show the name of the meeting to the user. By following the link (with id > >>as > >>parameter), user goes to the next page. Based on the id, I want to show > >>the > >>detail of the object (meeting). For my current implementation, I have to > >>iterate through every single object in the list and try to match the >key. > >>It > >> > >>works, but pretty stupid. Is there a better way to do it? Or should I >use > >>Hashmap (keyed by id) at the very beginning instead? > >> > >>Also, to use logic:iterate, is there something like a "break"? > >> > >>Thanks! > >>ds > >> > >>First page: > >> <logic:iterate id="m" name="meetings"> > >> <li> > >> <html:link > >> forward="showMeeting" > >> paramId="id" > >> paramProperty="id" > >> paramName="m"> > >> <bean:write name="m" property="name"/> > >> </html:link> > >> </li> > >> </logic:iterate> > >>It will build: > >>http://myproject/showMeeting?id=1 > >> > >>Second Page: > >><logic:iterate id="row" name="meetings"> > >><logic:equal name="row" property="id" value="<%=request.getParameter > >>("id")%>"> > >> <tr> > >> <TH align="right" width="50%">Meeting Name:</TH> > >> <TD align="left"><bean:write name="row" property="name"/></TD> > >> </tr> > >> ... > >></logic:equal> > >></logic:iterate> > >> > >>_________________________________________________________________ > >>MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. > >>http://join.msn.com/?page=features/virus > >> > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: [EMAIL PROTECTED] > >>For additional commands, e-mail: [EMAIL PROTECTED] > > > > > >_________________________________________________________________ > >Add photos to your messages with MSN 8. Get 2 months FREE*. > >http://join.msn.com/?page=features/featuredemail > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > >_________________________________________________________________ >Add photos to your e-mail with MSN 8. Get 2 months FREE*. >http://join.msn.com/?page=features/featuredemail > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]