Hi All

I am just a bit confused on the best approach to the MVC layering of my
application.

As an example lets say I have a Model that consists of a Supplier with n->m
Products.  An instance of Supplier will have a Collection of Product
objects.

For the maintenance View of Supplier I have an HTML form something like:

============================================================================
Supplier:               Acme Supplies
Contact Person:         Wile. E Coyote

Product List
------------
Product Name    Product Description             Price           Action

Dynamite100             100 sticks of dynamite          $100.00
EditProductLink
BirdTrap200             Titanium RoadRunner Trap        $300.00
EditProductLink

AddProductButton


                                SaveSupplierButton      CancelSupplierButton

============================================================================

The AddProductButton and EditProductLink display the form for adding/editing
a product.


Some of the questions I have:

1.  Would you keep the state of the view in the JSP or in the ActionForm?  

Currently I am using the ActionForm to keep the view state, so for example
the ActionForm has the supplier name and a collection of products.  The
collection is initiated from the Model and then updated via the product
add/edit actions.

 
2.  This then means that I am in effect replicating my Model and does not
feel so good.  Would a better approach be to have the ActionForm keep a
reference to the Model ... update the Model ... and then save or discard the
Model depending on the users final action (save or cancel)?

3.  Or would you have the view keep its state using attributes and update
the Action update the model from these.  I am not sure if I can keep a
collection (for example the Products) in a JSP and then add and update them
displaying the changes?


I hope I have used the correct terminology in asking these questions.

Thanks in advance for any pointers/comments/questions
Shane

Shane Mingins
Analyst Programmer
Assure NZ Ltd
Ph 644 494 2522



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

Reply via email to