struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arron Bates <>
Subject Re: MORE help with logic:iterate
Date Tue, 26 Feb 2002 03:45:08 GMT
In the nightly build, the nested tags will make easy work of this for 
you, simply swapping the tag header name a little to the following...
<nested:iterate property="myStudentListProperty">
<nested:write property="name" />

(no, you don't have to mess around with the id's and all that. Quite easy)

To get it working on your 1.02 build.... gor here and get the 1.0 jar...

And it will be waiting for you in the next release of Struts when you 
upgrade (or you can just keep using the separate jar :)
The above link also has a tutorial if you get a little stuck about any 
of it.


Saeid Zoonematkermani wrote:

> Hello all;
> I am sorry to bring this up again but I have looked at the docs and 
> the archives and I think I am following the instruction found in these 
> but I still can't get the iterate tag to work correctly. So I wanted 
> to post this question and see if I understand the methodology and 
> hopefully figure out what is wrong. I using struts-1.0.2.
> Let's say that I want to display a list of students. From the link 
> (Display Students) on page 1, I go to DisplayStudentsAction which goes 
> to the database and gets the list of students. I have a StudentBean 
> with 2 properties; name and id. The action gets the result set from 
> the database, populates one bean at a time and adds them to a vector. 
> At the end, I have a vector of StudentBeans. I put the vector in a 
> session attribute called student_list and forward to page 2.
> On page 2, I try to use the iterate tag to display a table of students 
> and I have tried all variations of id, name, and property I can think 
> of and some kind of error always shows up. Snippet of the JSP:
> <table>
> <tr>
> <td>NAME</td>
> <td>ID</td>
> </tr>
> <logic:iterate id="student" name="student_list" scope="session">
> <tr>
> <td>
> <bean:write name="student" property="name" filter="true"/>
> </td>
> <td>
> <bean:write name="student" property="id" filter="true"/>
> </td>
> </tr>
> </logic:iterate>
> </table>
> Some of the things I have done which were unsuccessful:
> - Added
> <jsp:useBean id="student" scope="page" type="packageName.StudentBean"/>
> or
> <jsp:useBean id="student" scope="session" 
> type="packageName.StudentBean"/>
> to the top of the JSP and still no use...
> The error I am getting most of the time is:
> javax.servlet.ServletException: bean student not found within scope
> Any help would be appreciated. I have read in the emails that nested 
> tags might be the way to go but I need to stay with an officially 
> released version of struts.
> Thanks in advance,
> - Saeid
> -- 
> To unsubscribe, e-mail: 
> <>
> For additional commands, e-mail: 
> <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message