If you make TO part of your form, life will be much easier.

e.g.

public class PlayerDetailsForm extends ValidatorForm {
  private PlayerDetailsTO mPlayer;
  public void setPlayerDetails(PlayerDetailsTO player) {
    mPlayer = player;
  }

  public PlayerDetailsTO getPlayerDetails() {
    return mPlayer;
  }
}

----- Original Message ----- 
From: "Sebastian Ho" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Wednesday, August 25, 2004 11:52 AM
Subject: ActionForm and Transfer Object


> Hi
> 
> People have been telling me that ActionForm should not be dependent on
> your TO. Simple because actionForm is for presentation and TO for your
> business requirement. Sounds logical and right way to go.
> 
> Now that I started developing using struts, it is actually not that
> simple. 
> 
> Say I retrieve a TO from database and convert it into a actionForm for
> display. In this case I have 4 fields for my actionForm but 10 in my TO.
> (6 are not needed for display). A user updates the 4 fields and the
> action convert those into TO. In this case, the other 6 fields will be
> reset to null(or empty) in my database!
> 
> To prevent this, I actually need to use hidden fields in my JSP or some
> other ugly solutions in my Action class. They are still dependent on
> each others afterall.
> 
> Is there a solution to this or I am missing something here?
> 
> Thanks
> 
> Sebastian Ho
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



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

Reply via email to