You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by David Johnson <ch...@gmail.com> on 2005/04/13 20:55:17 UTC

for an object that extends ArrayList in Application **and** Session

This may be off topic.,.. but I'll float it out there ...

I have an object in memory that I would like to iterate through on my
JSP page as follows:

The object is in the Session , and it is a PortfolioBeanCollection
which extends ArrayList. It contains a bunch of "PortfolioBean"
objects, which has a portfolioName attribute.

My question is .. what is the simplest way to use the <c:forEach> tag
to output the list of portfolioNames in the BortfolioBean objects
within the PortfolioBeanCollection?

Similarly, I have a separate set of "cross user portfolios" that are
of the same approximate structure but ate stored in the Application
context, and I need to list them as well....

what vital piece of understanding am I missing?

am I explaining thie clealy?

should I be using c:forEach or logic:iterate?
-- 
-Dave
ChaChaNY@Gmail.com

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


Re: [OT: JSTL] Re: for an object that extends ArrayList in Application **and** Session

Posted by Dave Newton <ne...@pingsite.com>.
Dave Newton wrote:

> <c:forEach items="${PortfolioBeanCollection}" var="pb">

Oops, missed the } in there.

Dave



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


[OT: JSTL] Re: for an object that extends ArrayList in Application **and** Session

Posted by Dave Newton <ne...@pingsite.com>.
David Johnson wrote:

>I have an object in memory that I would like to iterate through on my
>JSP page as follows:
>
>The object is in the Session , and it is a PortfolioBeanCollection
>which extends ArrayList. It contains a bunch of "PortfolioBean"
>objects, which has a portfolioName attribute.
>
>My question is .. what is the simplest way to use the <c:forEach> tag
>to output the list of portfolioNames in the BortfolioBean objects
>within the PortfolioBeanCollection?
>
>what vital piece of understanding am I missing?
>  
>
<c:forEach items="${PortfolioBeanCollection" var="pb">
  <c:out value="${pb.portfolioName}"/>
</c:forEach>

(where PortfolioBeanCollection is replaced by the name you put the 
object into session with) doesn't work?

Dave



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


Re: Validator error messages from different resource files

Posted by David Whipple <dw...@dtcc.com>.
Thanks much - this is what I was looking to find out.

Dave



|---------+---------------------------------->
|         |           "Niall Pemberton"      |
|         |           <niall.pemberton@blueyo|
|         |           nder.co.uk>            |
|         |                                  |
|         |           04/13/2005 06:18 PM    |
|         |           Please respond to      |
|         |           "Struts Users Mailing  |
|         |           List"                  |
|---------+---------------------------------->
  >----------------------------------------------------------------------------------------------------------|
  |                                                                                                          |
  |       To:       "Struts Users Mailing List" <us...@struts.apache.org>                                     |
  |       cc:       (bcc: David Whipple/DTCC)                                                                |
  |       Subject:  Re: Validator error messages from different resource files                               |
  >----------------------------------------------------------------------------------------------------------|




In the current struts release all you can do is use the bundle attribute on
the tags that display the error messages - i.e. either the <html:errors> or
<html:messages> tags. Something like

   <html:errors bundle="validator" />

for the example you use. See http://tinyurl.com/6zzvm for more details.

The Commons Validator DTD does have a "bundle" attribute defined for the
<msg> element, but it currently does nothing. I recently committed changes
which now support this - See http://tinyurl.com/6pl56 for more details.
Its
available in the nightly build if you want to try it out:
http://tinyurl.com/3mh2j

Niall

----- Original Message -----
From: "David Whipple" <dw...@dtcc.com>
Sent: Wednesday, April 13, 2005 9:31 PM


> Does anyone know a way have the Validator read the error messages for
> failed validation out of a non-default ApplicationResources.properties
> file?
>
> I am trying to separate the error messages out into a file that other
> developers need not and/or should not touch.  Actually it could be a set
of
> files, for different portions of the applications.
>
> I want to have the following in my struts config file:
>
>     <message-resources key="validator" parameter="ValidatorResources"/>
>     <message-resources key="application"
parameter="ApplicationResources"/>
>
> where to display something on a JSP you would need to use the
>
>     <bean:message bundle="application" key="message.something"/>
>
> to write it out.  I don't see anything where I can specify the "bundle"
for
> error messages in the validator.
>
> I have searched the web and the books I have but couldn't come up with
> anything.  Does anyone know anything about this?
>
> Thanks,
> Dave



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





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


Re: Validator error messages from different resource files

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
In the current struts release all you can do is use the bundle attribute on
the tags that display the error messages - i.e. either the <html:errors> or
<html:messages> tags. Something like

   <html:errors bundle="validator" />

for the example you use. See http://tinyurl.com/6zzvm for more details.

The Commons Validator DTD does have a "bundle" attribute defined for the
<msg> element, but it currently does nothing. I recently committed changes
which now support this - See http://tinyurl.com/6pl56 for more details.  Its
available in the nightly build if you want to try it out:
http://tinyurl.com/3mh2j

Niall

----- Original Message ----- 
From: "David Whipple" <dw...@dtcc.com>
Sent: Wednesday, April 13, 2005 9:31 PM


> Does anyone know a way have the Validator read the error messages for
> failed validation out of a non-default ApplicationResources.properties
> file?
>
> I am trying to separate the error messages out into a file that other
> developers need not and/or should not touch.  Actually it could be a set
of
> files, for different portions of the applications.
>
> I want to have the following in my struts config file:
>
>     <message-resources key="validator" parameter="ValidatorResources"/>
>     <message-resources key="application"
parameter="ApplicationResources"/>
>
> where to display something on a JSP you would need to use the
>
>     <bean:message bundle="application" key="message.something"/>
>
> to write it out.  I don't see anything where I can specify the "bundle"
for
> error messages in the validator.
>
> I have searched the web and the books I have but couldn't come up with
> anything.  Does anyone know anything about this?
>
> Thanks,
> Dave



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


Validator error messages from different resource files

Posted by David Whipple <dw...@dtcc.com>.
Does anyone know a way have the Validator read the error messages for
failed validation out of a non-default ApplicationResources.properties
file?

I am trying to separate the error messages out into a file that other
developers need not and/or should not touch.  Actually it could be a set of
files, for different portions of the applications.

I want to have the following in my struts config file:

    <message-resources key="validator" parameter="ValidatorResources"/>
    <message-resources key="application" parameter="ApplicationResources"/>

where to display something on a JSP you would need to use the

    <bean:message bundle="application" key="message.something"/>

to write it out.  I don't see anything where I can specify the "bundle" for
error messages in the validator.

I have searched the web and the books I have but couldn't come up with
anything.  Does anyone know anything about this?

Thanks,
Dave


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


Re: [OT: JSTL] Re: for an object that extends ArrayList in Application **and** Session

Posted by David Johnson <ch...@gmail.com>.
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 <ch...@gmail.com> 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 <ne...@pingsite.com> 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: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> --
> -Dave
> ChaChaNY@Gmail.com
> 


-- 
-Dave
ChaChaNY@Gmail.com

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


Re: [OT: JSTL] Re: for an object that extends ArrayList in Application **and** Session

Posted by David Johnson <ch...@gmail.com>.
makes total sense. thanks a lot :)

On 4/13/05, Dave Newton <ne...@pingsite.com> wrote:
> David Johnson wrote:
> 
> >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
> >
> >
> You don't need to cast in JSTL; JSTL does the Right Thing.
> 
> You give it a collection ('items' attribute, in your case a
> PortfolioBeanCollection, which is a collection, regardless of whatever
> additional functionality you've given it), a name to call each object in
> the iteration ('var' attribute, say you call it "portfolio"), and go.
> 
> The c:out tag says "Oh, you want the 'portfolio.portfolioName' to print
> out," tries to call getPortfolioName() on whatever object you've given
> it (hopefully a PortfolioBean, otherwise it will throw an exception),
> and displays the results.
> 
> I don't think I can explain it any differently.
> 
> Good luck!
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
-Dave
ChaChaNY@Gmail.com

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


Re: [OT: JSTL] Re: for an object that extends ArrayList in Application **and** Session

Posted by Dave Newton <ne...@pingsite.com>.
David Johnson wrote:

>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
>  
>
You don't need to cast in JSTL; JSTL does the Right Thing.

You give it a collection ('items' attribute, in your case a 
PortfolioBeanCollection, which is a collection, regardless of whatever 
additional functionality you've given it), a name to call each object in 
the iteration ('var' attribute, say you call it "portfolio"), and go.

The c:out tag says "Oh, you want the 'portfolio.portfolioName' to print 
out," tries to call getPortfolioName() on whatever object you've given 
it (hopefully a PortfolioBean, otherwise it will throw an exception), 
and displays the results.

I don't think I can explain it any differently.

Good luck!

Dave



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


Re: [OT: JSTL] Re: for an object that extends ArrayList in Application **and** Session

Posted by gd...@cmhc-schl.gc.ca.
David, can you post the code that defines the PortfolioBean.





David Johnson <ch...@gmail.com>
13/04/2005 04:21 PM
Please respond to "Struts Users Mailing List"




 
        To:     Struts Users Mailing List <us...@struts.apache.org>
        cc:     (bcc: Glenn Deschenes/NAT/CMHC-SCHL/CA)

        Subject:        Re: [OT: JSTL] Re: <c:forEach> for an object that 
extends ArrayList in Application **and** Session
 Classification: 
 


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 <ne...@pingsite.com> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
-Dave
ChaChaNY@Gmail.com

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




Re: [OT: JSTL] Re: for an object that extends ArrayList in Application **and** Session

Posted by David Johnson <ch...@gmail.com>.
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 <ne...@pingsite.com> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
-Dave
ChaChaNY@Gmail.com

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


[OT: JSTL] Re: for an object that extends ArrayList in Application **and** Session

Posted by Dave Newton <ne...@pingsite.com>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: for an object that extends ArrayList in Application **and** Session

Posted by David Johnson <ch...@gmail.com>.
Oh, and to answer the other question, I stored the
PortfolioBeanCollection on the session under the key

"userPortfolios" like this:

PortfolioBeanCollection myPortfolios= loadUserPortfolios(userID);
session.setAttribute("userPortfolios",myPortfolios);

On 4/13/05, David Johnson <ch...@gmail.com> 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?
> 
> On 4/13/05, Dave Newton <ne...@pingsite.com> wrote:
> > David Johnson wrote:
> >
> > ><c:forEach var="portfolio" items="${userPortfolios}">
> > >     <c:out value="${portfolioName}"/><br>
> > ></c:forEach>
> > >
> > >it outputs the proper number of <br> tags, but is not preperly
> > >displaying the correct PortfolioBeanCollection.PortfolioBean.portfolioName
> > >
> > >
> > You're not specifying the bean from which to get the property.
> >
> > <c:out value="${portfolion.portfolioName}"/>
> >
> > Dave
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> --
> -Dave
> ChaChaNY@Gmail.com
> 


-- 
-Dave
ChaChaNY@Gmail.com

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


Re: for an object that extends ArrayList in Application **and** Session

Posted by David Johnson <ch...@gmail.com>.
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?

On 4/13/05, Dave Newton <ne...@pingsite.com> wrote:
> David Johnson wrote:
> 
> ><c:forEach var="portfolio" items="${userPortfolios}">
> >     <c:out value="${portfolioName}"/><br>
> ></c:forEach>
> >
> >it outputs the proper number of <br> tags, but is not preperly
> >displaying the correct PortfolioBeanCollection.PortfolioBean.portfolioName
> >
> >
> You're not specifying the bean from which to get the property.
> 
> <c:out value="${portfolion.portfolioName}"/>
> 
> Dave
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
-Dave
ChaChaNY@Gmail.com

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


Re: for an object that extends ArrayList in Application **and** Session

Posted by Dave Newton <ne...@pingsite.com>.
David Johnson wrote:

><c:forEach var="portfolio" items="${userPortfolios}">
>     <c:out value="${portfolioName}"/><br>
></c:forEach>
>
>it outputs the proper number of <br> tags, but is not preperly
>displaying the correct PortfolioBeanCollection.PortfolioBean.portfolioName
>  
>
You're not specifying the bean from which to get the property.

<c:out value="${portfolion.portfolioName}"/>

Dave



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


Re: for an object that extends ArrayList in Application **and** Session

Posted by David Johnson <ch...@gmail.com>.
My First attempt was:

<c:forEach var="portfolio" items="${userPortfolios}">
     <c:out value="${portfolioName}"/><br>
</c:forEach>

it outputs the proper number of <br> tags, but is not preperly
displaying the correct

PortfolioBeanCollection.PortfolioBean.portfolioName

value..


hmmmm

On 4/13/05, David Johnson <ch...@gmail.com> wrote:
> This may be off topic.,.. but I'll float it out there ...
> 
> I have an object in memory that I would like to iterate through on my
> JSP page as follows:
> 
> The object is in the Session , and it is a PortfolioBeanCollection
> which extends ArrayList. It contains a bunch of "PortfolioBean"
> objects, which has a portfolioName attribute.
> 
> My question is .. what is the simplest way to use the <c:forEach> tag
> to output the list of portfolioNames in the BortfolioBean objects
> within the PortfolioBeanCollection?
> 
> Similarly, I have a separate set of "cross user portfolios" that are
> of the same approximate structure but ate stored in the Application
> context, and I need to list them as well....
> 
> what vital piece of understanding am I missing?
> 
> am I explaining thie clealy?
> 
> should I be using c:forEach or logic:iterate?
> --
> -Dave
> ChaChaNY@Gmail.com
> 


-- 
-Dave
ChaChaNY@Gmail.com

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