struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maris Orbidans" <M.Orbid...@datapro.lv>
Subject RE: iterate tag to repeat for a collection of individula objects
Date Tue, 26 Feb 2002 15:11:08 GMT
hi


The problem could be that the bean you are iterating isn't created in
any scope yet.
Try to go to action first - xxxx.do


Or you can check presence of the bean first like this:


<logic:present name="SearchResults" scope="request">
<p>
    <bean:message key="search.number"/> <%= ((java.util.Vector)
request.getAttribute("SearchResults")).size() %>
</p>
<table border='1' cellpadding='5' width='100%'>
    <tr>
        <th bgcolor='#ffd020'><bean:message key="search.name"/></th>
        <th bgcolor='#ffd020'><bean:message key="search.secname"/></th>
        <th bgcolor='#ffd020'><bean:message key="search.address"/></th>
        <th bgcolor='#ffd020'><bean:message key="search.phone"/></th>
        <th bgcolor='#ffd020'><bean:message key="search.work"/></th>
        <th bgcolor='#ffd020'><bean:message key="search.email"/></th>
        <th bgcolor='#ffd020'><bean:message key="search.comments"/></th>
    </tr>
    
    <logic:iterate id="element" name="SearchResults" scope="request"
type="addressbook.SearchResult">
        <tr>
        <td><jsp:getProperty name="element" property="name"/></td>
        <td><jsp:getProperty name="element" property="secondname"/></td>
        <td><jsp:getProperty name="element" property="address"/></td>
        <td><jsp:getProperty name="element" property="phone"/></td>
        <td><jsp:getProperty name="element" property="work"/></td>
        <td><jsp:getProperty name="element" property="email"/></td>
        <td><jsp:getProperty name="element" property="comments"/></td>
        </tr>
    </logic:iterate>
</table>
</logic:present>




Maris Orbidans


-----Original Message-----
From: Jay Milam [mailto:jmilam@radiants.com]
Sent: Tuesday, February 26, 2002 4:53 PM
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:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>



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


Mime
View raw message