What is it?
MyVelocityController is a
SIMPLE
MVC
Servlet Framework
for fast development of Web applications using a database backend based on
JDBC
(via
JNDI discovery).
Its main features are:
- The controller is very simple to configure
- The database access is made only through Velocity SQL templates
- The view is only allowed to use Velocity templates
- Fast deployment
Due to its orthogonality and very few exceptions, developing applications with MyVelocityController is much easier than with
Struts, however, if you're looking for complete control over application flow, stick with Struts, more on this later.
Why another MVC framework?
Note: the following are the original author's (John Villar) opinions, and must not be taken as a fact
or as an absolute truth, before doing conclusions do your own research and discuss it on the forums.
This framework was developed out of sheer frustration with the Struts configuration file. The Struts configuration file
is at its best confusing and incurs in some redundancies that aren't necesary for most applications. Another issue with
Struts is that the actually deployed codebase for tag libraries are JSP dependant and JSP is ill suited for large
applications and isn't too maintainable, also, JSP doesn't makes a big effort to separate the Model (a.k.a. Business Logic)
from the View.
Why choose MyVelocityController?
The main features of MyVelocityController are the following:
- Simple: configuring the controller is a matter of developing an action handling java class and mapping that class
to a URL relative to the application context on the "mappings" configuration file.
- Flat learning curve: based on the easy-to-learn Velocity templating engine, MyVelocityController makes it easy for
non-programmers to quickly learn dynamic web content development.
- Separation of Concerns: MyVelocityController makes a strong separation of data access, logic and presentation by
means of intelligent template handling. Changing a SQL statement or a web page doesn't imply a Servlet restart or a code
recompilation.
Following is a diagram that shows a, not very strict, sequence diagram of the controller when a client makes a request:
DIA diagram file
As you can see, application flow is rather simple. Redirections are handled on the "Action Handler". Overloaded concepts like
Forms and form resets, etc. are non-existent, instead a simple and effective parameter extraction class is provided for you
to get user parameters. If you are needing controller-handled forms, stick to Struts. In any other case, MyVelocityController
is your pick.
How looks the mapping file?
It is very simple, here is a snippet from a sample file of mine:
/index.vm=com.villarzavatti.fmmorpg.acciones.IndexAccion
/login.vm=com.villarzavatti.fmmorpg.acciones.LoginAccion
/logout.vm=com.villarzavatti.fmmorpg.acciones.LogoutAccion
/inicio.vm=com.villarzavatti.fmmorpg.acciones.InicioAccion
As you can see, the format is:
/[Relative, MyVelocityController matching, URL]=[Fully Qualified Class Name of the handling action]
MyVelocityController must be allowed to handle a set of files in the Webapp configuration file, it is done with the following
servlet mapping code:
<servlet>
<servlet-name>velocity</servlet-name>
<servlet-class>net.sf.myvelcont.MyVelocityControllerServlet</servlet-class>
<init-param>
<param-name>log</param-name>
<param-value>/WEB-INF/velocity.log</param-value>
</init-param>
<init-param>
<param-name>mappings</param-name>
<param-value>/WEB-INF/action.mappings</param-value>
</init-param>
<init-param>
<param-name>jndi_res</param-name>
<param-value>[JNDI NAME ON THE APP CONTAINER OF A JDBC RESOURCE]</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
...
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>*.vm</url-pattern>
</servlet-mapping>
Bugs & Requests
All bugs and requests should be addressed on the SF.net
development page.
Links
- Tomcat the reference JSP/Servlet container implementation.
- Velocity the templating engine used byt MyVelocityController.
- Struts the main inspiritation and source of frustation.
Contributing
This is a project developed on precious spare-time, which is a scarce resource :-), so there are many ways in which you can
contribute to the MyVelocityController project:
- Do some coding, bugfixing or feature addition. To do this, just download the code and modify it, you can join the development
team and begin making changes inmediatly, there are no prerequisites to being part of the team, just to have the time and the
enthusiasm.
- Do some maintainance. Webmasters, manual writers, examples, etc. are needed in every project, including this project!!
- Do some advertising. There is the button to put on your page linking to this page. Mouth to mouth recommendation is
the best medium (in terms of cost-effectivity). If you have a public running application developed with MyVelocityController we
would like to add a link to this page.
- Donate money/equipment. Money or equipment always helps to have more spare-time for people like me (the author) that don't have
a traditional Job. details on how to donate and what to donate can be obtained through johnvillarzavatti at gmail dot com.
- Join me on my business. I'm seeking people that want to earn extra cash without leaving their jobs or whatever they are
doing (professionals, students, etc.), earning margins are $500-$1000/monthly part time, details can be obtained through
johnvillarzavatti at gmail dot com.
Page hosted @
, the best source for OpenSource software.
This page is best viewed using any of the excellent Open Source Browsers, including Mozilla Firefox.
This page makes exclusive use of PNG images, Internet Explorer has broken support for them, complains about that will be
silently ignored. Complain with Microsoft.
Copyright (c) 2006 John Villar. Some rights reserved (
CC - Share Alike or newer "Share Alike" license).