I share the createX and editX actions form-beans "xForm" (I usually use
session scope because an extra special field called "vo").

  In "create action" I usually have an extra field ("vo") in my form-bean
that I donšt use.

  In "edit action" I must check if the "vo" exists (the bean that is being
edited), retrieve its id and see if it matches the id given on the form and
then do my work.
  the "vo" has also another important role... check if noone has changed
this bean when I am updating it (if I define a "lock" field on my bean OJB
will throw an OptmisticLockingException -> I think it is a good thing... but
I donšt use it for every kind of beans (example a bean with only id and
name... it makes less sense to do this)).

  On both actions I clean the form-bean session attribute.

  Using tiles definitions i reuse the jsp code (only 1 jsp file which can be
used in severall tiles definitions).

  a "viewX action" populates my form-bean (with my vo) so that data is
presented to the user when the user is forwarded.

  if you remove the "vo" field... you can use request scope on your
form-bean, forget cleaning the session and the rest stays the same.

  I hope I have explained myself well.

Pedro Salgado

On 12/1/05 10:29 am, "Mark Benussi" <[EMAIL PROTECTED]> wrote:

> I have a web based application which allows the Creation, Update, Read and
> Deletion of Data objects (Nothing new here).
> 
> All data changes are done by calling Manager methods with Action Forms to
> update the relevant data e.g.
> 
> new ShopManager().createOrder(createOrderForm);
> 
> or new ShopManager.updateOrder(updateOrderForm);
> 
> My problem is that I am having to create duplicate JSPs and actions for the
> create and update processes. The pages look exactly the same and hold the
> same values but the difference is that the update actions will pre populate
> the form with the existing methods and invoke the update method on the
> manager instead of a standard create. Even the forms are identical (The
> update form extends the create form but holds a reference to the data id
> that is to be updated).
> 
> My question is: Is there a way to have one set of JSPs, Forms and actions to
> manage all of this. When I change a JSP I am having to maintain two pages
> which sounds trivial but to me shouts of bad design. The only difference
> between the pages is that they call different actions i.e.
> /order/create/stage1.do vs /order/update/stage1.do
> 
> I would be interersted to know peoples thoughts.
> 
> Cheers,
> 
> Mark
> 
> 
> 
> ---------------------------------------------------------------------
> 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