velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Malcolm Edgar" <Malcolm.Ed...@macquarie.com>
Subject RE: MVC with velocity
Date Fri, 15 Jul 2005 00:11:54 GMT
Hi Andrew,

You are right what is typically called MVC in web applications, is
actually a command pattern with a separate tier for rendering.

The original MVC pattern is a sophisticated Observer (publish/subscribe)
pattern for rich clients, where and views and controls (as they are
often the same thing) are updated when modifications are made to data
via a control. This is why there was so much discussion about Push and
Pull MVC in the early days as people tried to figure out how the could
label web applications as MVC.

See http://click.sourceforge.net/docs/why-click.html section on JSP &
MVC for more details.

regards Malcolm Edgar

-----Original Message-----
From: Andrew Mason [mailto:andrew@assertis.co.uk]
Sent: Friday, 15 July 2005 12:46 AM
To: velocity-user@jakarta.apache.org
Subject: MVC with velocity


Hi, just trying to understand the model view controller design pattern
and how 
to apply Velocity to it.
 
I've got a web-app, which has a main-control web-page with links as such
down
one side (it currently uses a velocity servlet to render a template to
display
it to the browser): 
 
 
________________________ 
 - Edit Products 
  - Add Product 
  - Edit Products 
  - Remove Products 
 
 - Manage Emails 
  - Add account 
  - Remove account 
________________________ 
 
So far I have it working like this: 
Clicking on 'Add Product'  means that a new page loads with controls on
the
right, which allow you to add a product . Which then of course provides
you 
with
a form to add the product. This obviously goes off to the database to
add the
product then returns the details to the screen. All of these pages are 
rendered
by the velocity servlet. 
 
I have classes which are called in the velocity servlet, that do things
like
adding products, getting product information etc..but ultimately its 1 
velocity servlet that handles adding the product  and then gettingthe
new 
product info and rendering the template. 
I then have another velocity servlet which handles editing the products,

another one for removing etc..

 
Correct me if i'm wrong but this doesn't seem like i'm using MVC
pattern, and 
I was hoping someone could post an example (not code) of how to handle
this
problem using MVC, with servlets and velocity. I've read quite a few
articles and books (Mastering tomcat development etc..) on it but i am
having 
trouble grasping how i would use it in this
situation. 
 
thanks in advance

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message