You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jay Milam <jm...@radiants.com> on 2002/02/26 15:52:31 UTC

iterate tag to repeat for a collection of individula objects



I need to have a struts logic:iterate tag, which has to repeat a set of tag
for a collection of individual objects.

I have a .jsp page , which contains Logic iterate tag

	  <logic:iterate id="client" name="clientList" property="clients" >
		  <bean:write name="client" property="clientType"  />
		  <bean:write name="client" property="dateOfBirth"  />
	  </logic:iterate>

Where 'clientList' is a bean which contain 'clients'(ArrayList) as member.

The form bean for this .jsp contains 'clientList' as a member.

In the action class  the following step are done
for i=1 to x
1. Create new Client object. ( Where Client object contains, 'clientType' 
and 'dateOfBirth' as members)
2. Add that Client object to the 'clientList'
next i


The scope in the action-mapping for this action is set to 'session' in the 
struts config file.

I am getting 'cannot find bean clientList in scope null: 
javax.servlet.jsp.JspException.






_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: iterate tag to repeat for a collection of individula objects

Posted by Robert Nocera <rn...@neosllc.com>.
In your iterate tag, name should be the name of the form bean, and
property should be the name of the form variable that contains the list.
You also probably need the type attribute to specify what type of
objects the list contains.

In the code you provided it's looking for a form bean called
"clientList" that contains a collection called "clients".

Robert Nocera
New England Open Solutions
www.neosllc.com
"You supply the vision, we'll do the rest."
 

-----Original Message-----
From: Jay Milam [mailto:jmilam@radiants.com] 
Sent: Tuesday, February 26, 2002 9:53 AM
To: struts-user@jakarta.apache.org
Subject: iterate tag to repeat for a collection of individula objects




I need to have a struts logic:iterate tag, which has to repeat a set of
tag
for a collection of individual objects.

I have a .jsp page , which contains Logic iterate tag

	  <logic:iterate id="client" name="clientList"
property="clients" >
		  <bean:write name="client" property="clientType"  />
		  <bean:write name="client" property="dateOfBirth"  />
	  </logic:iterate>

Where 'clientList' is a bean which contain 'clients'(ArrayList) as
member.

The form bean for this .jsp contains 'clientList' as a member.

In the action class  the following step are done
for i=1 to x
1. Create new Client object. ( Where Client object contains,
'clientType' 
and 'dateOfBirth' as members)
2. Add that Client object to the 'clientList'
next i


The scope in the action-mapping for this action is set to 'session' in
the 
struts config file.

I am getting 'cannot find bean clientList in scope null: 
javax.servlet.jsp.JspException.






_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>