You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul Blundell <pa...@yahoo.com> on 2003/03/06 16:37:03 UTC

Iterating through a Map collection of Beans

Does anyone have any examples of code for iterating through a Map containing

The application is storing data related to a Location. A location can
contain several rooms, so on the form there will be fields such as:

Locationname
Locationcity
Locationcountry

Room1name Room1description
Room2name Room2description
Room3name Room3description

The room will be defined as a bean, the bean holding name and description.
The Location will hold all the room beans in a Map.

Could anyone show me/point me at some example JSP and Java code which is
similar to what I am trying to do here

Thanks
Paul



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


RE: Iterating through a Map collection of Beans

Posted by apachep2 <ap...@hotmail.com>.
Location bean is made up of

Locationname
Locationcity
Locationcountry
And a Map, rooms

Rooms consist of 3 room beans

Room1name Room1description
Room2name Room2description
Room3name Room3description

Assume there is a session/request/page scope Object location. On JSP
page using struts,

<bean:write name="location" property="Locationname"/>
<bean:write name="location" property=" Locationcity"/>
<bean:write name="location" property=" Locationcountry"/>
<logic:iterate name="location" property="rooms" id="room">
	<bean:write name="room" property="roomname"/>
	<bean:write name="room" property="roomdescription"/>
</logic:iterate>

I suggest you study the struts-example came with struts source and
mokey/banana example in struts documentation.

-----Original Message-----
From: Paul Blundell [mailto:paulblundell@yahoo.com] 
Sent: March 6, 2003 10:37 AM
To: struts-user@jakarta.apache.org
Subject: Iterating through a Map collection of Beans

Does anyone have any examples of code for iterating through a Map
containing

The application is storing data related to a Location. A location can
contain several rooms, so on the form there will be fields such as:

Locationname
Locationcity
Locationcountry

Room1name Room1description
Room2name Room2description
Room3name Room3description

The room will be defined as a bean, the bean holding name and
description.
The Location will hold all the room beans in a Map.

Could anyone show me/point me at some example JSP and Java code which is
similar to what I am trying to do here

Thanks
Paul



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

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