struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <davelnew...@gmail.com>
Subject Re: Tag iterator and my object container
Date Tue, 10 May 2011 14:29:26 GMT
Or just access the map and use the Map.Entry object map iterators supply.

Dave
 On May 10, 2011 9:16 AM, "Steven Yang" <kenshin520@gmail.com> wrote:
> you need to implement the Iterator interface
>
> On Tue, May 10, 2011 at 4:14 PM, <Matthieu.Marc@ensam.eu> wrote:
>
>> Hi everybody,
>>
>> I have a container object SearchResults which contains a treeMap of
simple
>> object SearchResult.
>>
>> I want to iterate over SearchResults in order to display properties of
all
>> SearchResult object
>>
>> Class SearchResult {
>> //getter and setter
>> getDescription();
>> }
>>
>> Class SearchResults {
>> treeMap<String, SearchResult> resultats;
>>
>> public Set<String> keyset();
>> public Iterator<String> iterator();
>> public SearchResult get(String key);
>> }
>>
>> My Action class have this getter :
>>
>> getResultats(){ return (SearchResults)object; };
>>
>> And my JSP look like :
>>
>> <s:iterator value="resultats">
>> <s:property value="description" />
>> </s:iterator>
>>
>>
>> But it is not working, s:iterator tag is not iterating over my
>> SearchResults object using the iterator() method (not called).
>>
>> How must I construct my SearchResults object in order to make the
>> s:iterator tag iterate over it ?
>>
>> Thanks.
>>
>> Matthieu MARC
>>
>> ---
>> Matthieu MARC
>> Responsable du Service Informatique du Centre d'Angers
>> Arts et Métiers ParisTech
>> Tél : 02 41 20 73 61
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message