1.
Nope. Only that ArrayList will be slightly faster at runtime because 
there's no synchronization for threads on the class (and doesn't need to 
be, as there's only one bean to a user). Vector will work fine though. 
Most likely not a noticeable speed difference.

2.
Yes, they are nested beans. And no, they don't need to extend anything 
special.

3.
That part is up to you. As for the indexed tags, they're not in the 
1.0.2 distribution. So you could only get them if you updated your 
release to 1.1beta. If you get that, then you have the nested tags also. 
I'm probably bias but I find the nested tags easier to use for 
iterations and have a wider range of ability beyond that. If you want to 
keep running the older Struts (1.0.2), then you can pick up a library to 
use them from my site which has the ability of the nested tags in the 
current Struts distrib...
http://www.keyboardmonkey.com/struts

There's also a tutorial and primer on how to use the tags, including the 
creation of lists in the way that you're after.

Arron.

Annie Chang wrote:

>Hi Arron,
>
>Thank you for your reply.
>
>1.
>My form bean in the same way as you said. But the types of "subscriptions"
>and "webs"
>are Vector, not ArrayList. Is this an issue?  My 3 java classes for this
>form are attached
>in my former email, please take a look at them.
>
>2.
>The elements of "subscriptions" and "webs" are "nested beans", right?
>Should the nested
>beans be subclass of "ActionForm"? or just normal bean?
>
>3.
>Which versions of Tomcat and Struts are the best?
>I'm using Tomcat3.2.1 and Struts1.0.2
>Where to get "a tag library that have the indexed tag"?  I got the following
>error:
>
>when I compile the project, all java files are passed. But complie error at
>registration.jsp :
>
>      <html:text name="subscription" property="host" indexed="true"/>
>
>"registration.jsp": Attribute indexed invalid according to the specified TLD
>at line 145, column 7
>
>Thanks.
>
>----- Original Message -----
>From: "Arron Bates" <[EMAIL PROTECTED]>
>To: "Annie Chang" <[EMAIL PROTECTED]>
>Sent: Sunday, March 24, 2002 5:28 PM
>Subject: Re: Multi Indexed & Nested properties samples?
>
>
>>This shouldn't be an issue at all. All the lists and properties are
>>properties of the one bean.
>>
>>Your bean should have the following properties...
>>    name
>>    email
>>    phone
>>    address
>>
>>    subscriptions - ArrayList of the subscription objects
>>    webs             - ArrayList of the web objects
>>
>>
>>JSP marked up in simple fashion. All within the form tags, simply put
>>the text inputs for the first properties, then have an iterate tag for
>>the subscriptions writing out the list of nested beans, then another
>>separate iterate tag for the webs input writing out that list of beans.
>>
>>All updated to the server in the one form. Because of this, it all has
>>to be from the one form bean.
>>
>>
>>Arron.
>>
>>
>>
>>Annie Chang wrote:
>>
>>>Arron,
>>>
>>>I want to let the user modify all informations in one page like this way:
>>>
>>>*--------------------------------------------------------------------
>>>|  User Information:
>>>|         Name:________     Telephone:_____________________
>>>|         Email:_________    Address:______________________
>>>|
>>>|  Subscriptions:
>>>|         Host          User Name   Password    Type  Autoconnect
>>>|         _______   ________   ________   ____  __________
>>>|         _______   ________   ________   ____  __________
>>>|         _______   ________   ________   ____  __________
>>>|         _______   ________   ________   ____  __________
>>>|
>>>|  Interested Webs:
>>>|         Catalog      Name        URL
>>>|         _______   _______    __________________________
>>>|         _______   _______    __________________________
>>>|         _______   _______    __________________________
>>>|         _______   _______    __________________________
>>>|
>>>|
>>>|    Save
>>>*----------------------------------------------------------------------
>>>
>>>Three parts are all in one form. One "save" button can save all the
>>>informations in the screen.
>>>
>>>My question is does this form bean can be auto-populated by Struts?  The
>>>form bean and two beans' class of Vectors are described below.
>>>How to write the jsp for this form?
>>>
>>>public final class UserForm extends ActionForm {
>>>   private name = null;
>>>   private telephone = null;
>>>   private email = null;
>>>   private address = null;
>>>
>>>   private Vector subscriptionList = new Vector();      // elements'
>>>
>Type
>
>>>is Subscription (see below)
>>>   private Vector interestedWebList = new Vector();  // elements' Type
>>>
>is
>
>>>InterestedWeb(see below)
>>>
>>>   public String getName()  {  return name;  }
>>>   public String getTelphone()  {  return telephone ;  }
>>>   public String getEmail()  {  return email ;  }
>>>   public String getAddress()  {  return address;  }
>>>
>>>   public Vector getSubscriptionList()  {  return subscriptionList;  }
>>>   public Vector getInterestedWebList()  {  return interestedWebList;  }
>>>
>>>   public void setname(String s)  {  name = s;  }
>>>   public void setTelphone(String s)  {  telephone = s;  }
>>>   public void setEmail(String s)  {  email = s;  }
>>>   public void setAddress(String s)  {  address= s;  }
>>>
>>>   public void setSubscriptionList(Vector v)  {  subscriptionList =
>>>
>;  }
>
>>>   public void setInterestedWebList(Vector v)  {  interestedWebList =
>>>
>;  }
>
>>>}
>>>
>>>public final class Subscription{
>>>   private String host = null;
>>>   private String userName = null;
>>>   .......
>>>
>>>  public:  // setters and getters
>>>  public String getHost() {return host}
>>>  public String getUserName() {return UserName}
>>>  ...
>>>  public void setHost(String s) {host = s;}
>>>  public void setUserName(String s) {UserName = s;}
>>>}
>>>
>>>public final class InterestedWeb{
>>>   private String catalog = null;
>>>   private String name = null;
>>>   private String url = null;
>>>   .......
>>>
>>>  public:  // setters and getters
>>>  public String getCatalog() {return catalog}
>>>  public String getName() {return name}
>>>  ...
>>>  public void setCatalog(String s) {catalog = s;}
>>>  public void setName(String s) {name = s;}
>>>}
>>>
>>>
>>>
>>>
>>>----- Original Message -----
>>>From: "Arron Bates" <[EMAIL PROTECTED]>
>>>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>>>Sent: Sunday, March 24, 2002 3:49 PM
>>>Subject: Re: Multi Indexed & Nested properties samples?
>>>
>>>
>>>>Annie,
>>>>
>>>>Somehow you're using a tag library that doesn't have the indexed tag
>>>>ability. The error is complaining that you've specified the
>>>>indexed="true" attribute, but it doesn't know about it one way or
>>>>
>another.
>
>>>>When you speak of two vecotrs, is one return from a bean in the
>>>>
>other?...
>
>>>>Anyways, This stuff is easier with the nested tags. Learn about them
>>>>here...
>>>>http://www.keyboardmonkey.com/struts
>>>>
>>>>And yes, you can have whatever you want editable on your list. The
>>>>nested tags intro and tutorial on the site above should show you
>>>>everything you'd need to know about editing things in lists, nested
>>>>lists or whatever. There's a primer and tutorial to get you going.
>>>>
>>>>
>>>>Arron.
>>>>
>>>>Annie Chang wrote:
>>>>
>>>>>Hi,
>>>>>
>>>>>Can I jump in and ask a question related with this?
>>>>>
>>>>>I modified the example come with struts 1.0.2. I want let the user edit
>>>>>all Subscriptions at the same time within the page "registration.jsp"
>>>>>My requirements are similar to (but I want multi array properties in
>>>>>
>one
>
>>>>>form, see blue font text below)
>>>>>
>>>>http://www.mail-archive.com/struts-user@jakarta.apache.org/msg12085.html
>>>>
>>>>>and
>>>>>
>>>>http://www.mail-archive.com/struts-user@jakarta.apache.org/msg12084.html
>>>>
>>>>>I doing the following with the sample:
>>>>>
>>>>>Add a Form Bean named "SubscriptionsForm" and an action bean named
>>>>>"SaveSubscriptionsAction" and modifid the registration.jsp
>>>>>
>>>>...
>>>>
>>>>>Problem is : when I compile the project, all java files are passed. But
>>>>>complie error at registration.jsp :
>>>>>    <html:text name="subscription" property="host" indexed="true"/>
>>>>>
>>>>>"registration.jsp": Attribute indexed invalid according to the
>>>>>
>specified
>
>>>>>TLD at line 145, column 7
>>>>>
>>>>>What's the matter?  Dose Struts auto-populate Vector
>>>>>SubscriptionsForm::subscriptionList for me correctly??
>>>>>
>>>>>Further questions:
>>>>>1. Can I merge the two forms in registration.jsp? I mean Can let the
>>>>>user modify the registration information and subscriptions using one
>>>>>submit button?
>>>>>2. Suppose the user has another list - "interested webs", and we want
>>>>>
>to
>
>>>>>let the user modify them together with other informations in the same
>>>>>way of subscriptions. So, we have two Vector in the form bean, how the
>>>>>jsp and form bean would be?
>>>>>
>>>>>
>>>>>Can you give me any suggestion?
>>>>>
>>>>>Thanks very much!
>>>>>
>>>>>Annie
>>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:
>>>>
>>><mailto:[EMAIL PROTECTED]>
>>>
>>>>For additional commands, e-mail:
>>>>
>>><mailto:[EMAIL PROTECTED]>
>>>
>>
>>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to