Annie

MUTATOR You will need the mutator method obviously `public void setName( String )'

PREFERS INTERFACES Instead of using java.util.Vector, prefer to using an Java
Collection interface java.util.List.

public List getSubscriptionList()
{
   List list = new ArrayList();
   // fill her up
   return list;
}

Pros; you change the type of ``List'' in the future. Suppose a better list appears 
tomorrow
Cons: no problem


DELEGATE if you have a business object or DAO consider delegation to access.
Instead copying the accessor / mutators of the DAO to the ActionForm.
Let the DAO be a delegate because Struts supports ``nested bean properties''
out of the box,


public class CreditDetailDAO  { ....
     public String getAuthority() { .. .}
}

public class Employee extends ActionForm {

// Delegate it!
private CreditDetail cred;
public CreditDetailDAO  getCreditDetail() { return cred; }
public void setCreditDetail( CreditDetailDAO c ){ this.cred = c };
}

Then JSP can be written like so <bean:write name="obj" 
property="creditDetail.authority" />

--
Peter Pilgrim                       ++44 (0)207-545-9923

............................................ Swamped under electronic mails


---------------------------------------- Message History 
----------------------------------------


From:  "Annie Chang" <[EMAIL PROTECTED]> on 24/03/2002 16:39 PST

Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]>

To:    "Struts Users Mailing List" <[EMAIL PROTECTED]>
cc:    <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Subject:    Re: Multi Indexed & Nested properties samples?


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
*----------------------------------------------------------------------


--<CUT>--


--

This e-mail may contain confidential and/or privileged information. If you are not the 
intended recipient (or have received this e-mail in error) please notify the sender 
immediately and destroy this e-mail. Any unauthorized copying, disclosure or 
distribution of the material in this e-mail is strictly forbidden.



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

Reply via email to