Bingo, that was it. The link you sent dealt with exatly what I was talking about.
Thank you sir. :) On 4/13/05, David Johnson <[EMAIL PROTECTED]> wrote: > Hey > > That totally makes sense, and I definitely see hot to iterate through > a collection of Strings or other straightforward things, but what I'm > confused about is that my PortfolioBeanCollection (extends ArrayList) > contains objects of type "PortfolioBean" which in turn contain the > attribute I'm trying to display..so the PortfolioBean itself has no > explicit name to which I can refer... > > so I really want to do something like > > PortfolioBeanCollection.PortfolioBean.portfolioName > > normally, I'd just loop through the PortfolioBeanCollection casting > the resulting Object into a PortfolioBean then calling the > getPortfolioName() method on the bean > > The examples I'be found deal more with simple Collections of Strings, > ints, etc. where you might have a collection of "teachers" for example > and want to print out the firstName attribute of each... whereas my > example has another later. > > I might be babbling. Does that make sense? > > On 4/13/05, Dave Newton <[EMAIL PROTECTED]> wrote: > > David Johnson wrote: > > > > >that makes sense, but the individual portfolios (the members of the > > >PortfolioBeanCollection) dont really have a name, I just looped > > >through my result set doing > > > > > >PortfolioBeanCollection PBC=new PortfolioBeanCollection (); > > >while (result.hasnext){ > > > pbc.add (new PortfolioBean(resultSet.getString("namefield"))); > > >} > > > > > >so I really just used the PortfolioBeanCollection as if it were a > > >garden variety ArrayList.... does your comment still apply? > > > > > > > > Of course--you have to tell the <c:out...> tag a) what bean to get the > > property from and b) what property to display. When you say <c:forEach > > items="${userPortfolios}"...> you are telling c:forEach what collection > > to use for the iteration. When you say <c:forEach var="portfolio"...> > > you are creating a variable you can use in other JSTL tags--in essence > > naming each portfolio bean "portfolio" for the purposes of JSTL. > > > > But you still have to tell <c:out...> what bean and what property, > > otherwise how would it know what to print? When you just say <c:out > > value="${portfolioName}"/> it's looking for an application, session, > > request, or page scoped attribute named "portfolioName". Without the > > prepended "portfolio" it doesn't know that the property "portfolioName" > > is associated with a bean created through the c:forEach iterator. > > > > I'd recommend checking out some very basic JSTL docs to get a feel for > > how JSTL works: > > http://www.onjava.com/pub/a/onjava/2002/08/14/jstl1.html > > http://www.onjava.com/pub/a/onjava/2002/09/11/jstl2.html > > > > Dave > > > > (Wouldn't it have been quicker to just but the property name in your > > code and see if it worked?) > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > -- > -Dave > [EMAIL PROTECTED] > -- -Dave [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]