velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Schnitzer" <>
Subject RE: newbie: What `controller' to use with Velocity `view'?
Date Tue, 03 Jul 2001 21:09:50 GMT
> From: Chris Shenton []
> I'd like to move into Velocity for `view' but am befuddled by what
> `controller' to use.  Sounds like most Velocity developers are using
> Jakarta-tomcat, which I haven't played with yet -- does it function as
> a `controller', or is a controller just part of the tomcat framework?
> Is it possible to use Velocity with jserv? Other suggestions?

You will probably find this document helpful:

Tomcat (more or less like Jserv) is a "web container".  It handles HTTP
requests and provides all the facilities defined by the Servlet api.  By
default it has a simplistic "controller" that simply maps URL requests
to specific documents (typically html or jsp), but this won't help you
with Velocity.

You need some sort of framework to set up the Velocity context (the
"model") prior to rendering of a view.  One option is to use the
VelocityServlet in the Velocity distribution.  Another option is a more
comprehensive MVC framework like Turbine, Struts, or Maverick which
allow URLs to be mapped to Java controller classes which then produce
models which are rendered by views.  Be sure to read this section of the
above document:

...and realize that in the Model 2 case, you can substitute "Velocity"
for "JSP" pretty much indiscriminately.

> For a Java newbie like me, some of the larger frameworks like what I
> believe Struts or Turbine offer would be overkill.  Or maybe I should
> just dive into them if they offer a sufficiently sophisticated
> environment that I can leverage their facilities.  But at this point
> I'm looking for simplicity and a less steep learning curve.
> Suggestions welcome.

As one of its authors, I naturally recommend the Maverick MVC framework:  

It's quite a bit simpler than Struts or Turbine, and it includes a
fairly comprehensive example Velocity application.  You should probably
be using Tomcat v4, though - JServ is definitely out of the question.

Jeff Schnitzer

View raw message