struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frost, Gary [IT]" <>
Subject Re: Nested Bean Problem
Date Mon, 28 Jul 2003 05:35:42 GMT
Or you could create a new class, JBNCCArrayList  (Java Bean Naming
Convention Compliant Array List) or some other (nicer) name,  that extends
ArrayList (remember to include all the appropriate constructors), that adds
the following method
	public int getSize()
		return size();

And use that in place of the ArrayList.  This will allow the BeanUtils to
get the size  (e.g. "userBean.roleUser[0].menuComponent.size") because the
naming convention is in place, and this solution does not require extra
object creation (as in the CollectionBean suggestion).

I really think Sun should fix this, it annoys the c*!p out of me, I
personally can't see the harm in 'adding' the Collection Classes to fix this
naming convention error, by adding (not a wholesale rename) they can
maintain backward compatibility (perhaps marking size() as deprecated).  But
then I'm not a Language Specification writer, so maybe I'm missing


-----Original Message-----
From: Nagaraj_K []
Sent: Friday, 25 July 2003 3:15 PM
To: Struts Users Mailing List
Subject: RE: Nested Bean Problem

Why not add a method in the roleUserBean which returns the size of the
ArrayList menuComponent Bean? Using the index of the iterator you will get
the roleUserBean component using which u can get the size of the
menuComponent ArrayList.


-----Original Message-----
Sent: Friday, July 25, 2003 10:39 AM
To: Struts Users Mailing List
Subject: Re: Nested Bean Problem

Actually the ArrayList menuComponentBean is having all the menuNames which
I am showing in the top header row of a html table. I want to set the
colspan of all the other rows equal to the number of menu items in this




                    Kumar O V S"         To:
                    <nagendra@iki        cc:

          >              Subject:     Re: Nested Bean


                    10:22 AM


                    respond to

                    "Struts Users

                    Mailing List"





 why do u want to get the size of the collection...?

 u can use indexId attribute which gives the index of the iterator


 -- nagi


 -------Original Message-------


 From: Struts Users Mailing List

 Date: Friday, July 25, 2003 09:57:28 AM


 Subject: Nested Bean Problem



 I have a problem handling nested beans..

 For example...

 I have a userBean as given below

 private int userID;

 private String lastName;

 private String firstName;

 private ArrayList roleUser;

 Where the last field Arraylist is the arraylist of the objects of the bean

 called roleUserBean.


 Again the roleUserBean has the following properties.

 private int roleid;

 private String desc;

 private String name;

 private ArrayList menuComponent;

 The last property menuComponent is the arrayList of objects of the bean

 called menuComponentBean.


 Now the menuComponentBean contains

 private int menuID;

 private String menuName;

 private String description;



 I have put the userBean in the session scope. Now I want to know how many

 objects are there in the menuComponentBean (size of the ArrayList

 menuComponentBean). I am not able to get that. Please help.


 Thanks in advance.

 Prashant M Desai.





 To unsubscribe, e-mail:

 For additional commands, e-mail:








 To unsubscribe, e-mail:

 For additional commands, e-mail:












  IncrediMail - Email has finally evolved - Click Here

To unsubscribe, e-mail:
For additional commands, e-mail:
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.

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

View raw message