[opencms-dev] Model View Controller and OpenCMS
Claus Priisholm
cpr at codedroids.com
Thu Apr 19 09:54:54 CEST 2007
I've needed something akin to mvc for a couple of administrative tools.
To formalize it a bit I've build a state machine which gets instantiated
based on a XML file loaded from the VFS - basically a dynamic variant of
the one described here:
http://www.onjava.com/pub/a/onjava/2001/06/27/java_security.html
It is based on including some controller JSP for processing the request
and, dependent on the outcome of that, include the appropriate view JSP.
By only using includes rather than forwarding, and by sitting "behind"
the OpenCms servlet there is no "conflict" with the OpenCms servlet.
The outset for the article is security but in the end it provides a
separation of the view and the controller logic.
It has proven to be useful for building simple administrative tools. If
you're looking to build large scale web application, you should probably
look to the more well known web app frameworks, and then find a way for
it to co-exist with OpenCms. There have been discussions on the list
regarding struts as mentioned by someone else, and also for JSF for a
more modern/component oriented approach.
Raúl Lorenzo wrote:
> Hello,
>
> I am trying to implement a site with OpenCMS using MVC pattern. Someone
> has done it?
> Next are some theories:
>
> I want that JSP only has View Logic. So JSP shouldn´t know something
> about Controller and Model.
> The controller, in teorical context, were the Servlets; but OpenCMS
> implements it´s own Servlet.
>
>
> OpenCMSServlet -> (fordward to resource requested, p.example a JSP) ->
> So with this focus the view always call a Controller or a class inside a
> Jar Library.
>
> My trying is something like this,
>
> OpenCMSServlet -> MainJSP (In this MainJSP forward to a new mainServlet
> for the site I am creating) -> MainSiteServlet -> MVC starts here.
>
> What do you think? Any Idea?
>
> Thanks in advance
>
>
--
Claus Priisholm, CodeDroids ApS
Phone: +45 48 22 46 46
cpr (you know what) codedroids.com - http://www.codedroids.com
cpr (you know what) interlet.dk - http://www.interlet.dk
--
Javadocs and other OpenCms stuff:
http://www.codedroids.com/community/opencms
More information about the opencms-dev
mailing list