Hello,

Most web applications which use MMBase as the content engine usually become
a model 1 architecture, because the taglib is powerfull enough to handle
process-intensive tasks. A model 2 architecture separates the dynamic
presentation from process-intensive tasks. If you have used a model 2
framework like struts or jsf then you probably prefer that. At least I do.
Model 2 frameworks usually provide easy form-processing. The editwizards are
nice for simple forms, but they can't be used with forms which require
backend validation logic. A model 1 architecture has in most cases more code
duplication and it is easy to forget to include some application logic in a
jsp. 
The leeuwarden.nl project is a mix of model 1 and model 2. Some parts use
struts to handle the user interactions and other parts use the mmbase
taglib. The struts parts use the MMBase api. The mm:cloud tag adds the user
cloud in the session. You can use the cloud in the struts action and in the
jsp's.

    public static Cloud getCloud(HttpServletRequest request) {
        String sessionname = "cloud_mmbase";

        HttpSession session = request.getSession(false);
        if (session != null) {
            Cloud cloud = (Cloud) session.getAttribute(sessionname);
            if (cloud != null) {
                log.debug("cloud for user " +
cloud.getUser().getIdentifier());
                return cloud;
            }
        }
        throw new RuntimeException("No cloud instance in user session.");
    }

The mm:import externid can read parameter and attributes from the request
and session. You can pass stuff to the mmbase taglib with this.

Another advantage is that the struts-config.xml can be generated from the
javadocs with the xdoclet libraries. The struts configuration is then near
the action which reduces misconfiguration.

   <target depends="init" description="Re-Generate struts-config.xml using
XDoclet" name="webdoclet">
      <taskdef classname="xdoclet.modules.web.WebDocletTask"
classpathref="base.classpath" name="webdoclet"/>
      <delete file="${webinf.dir}/struts-config.xml"/>
      <webdoclet destdir="${webinf.dir}">
         <fileset dir="${java-web.dir}">
            <include name="**/*.java"/>
         </fileset>
         <!-- ${webinf.dir} contains global-forwards.xml and
struts-message-resources.xml -->
         <strutsconfigxml mergedir="${webinf.dir}" validateXML="true"
version="1.1"/>
      </webdoclet>
   </target>

My view on MMBase is that it is a content engine which has some tools to
create a frontend fast. It is just up to the application developer to have a
model 1 or model 2 architecture.

Nico


> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Namens [EMAIL PROTECTED]
> Verzonden: vrijdag 1 oktober 2004 9:20
> Aan: [EMAIL PROTECTED]
> Onderwerp: MMBase -> Model 2 architecture
> 
> 
> Hi,
> 
> I'm (also) working on Didactor. I'm seeking for ways to 
> improve Didactor's session management.  
> Could anyone tell me if there are ideas to extend or change 
> MMBase in a way, that it is based on a model 2 architecture. 
> At this point, I was thinking about incorperate the JSF technique.
> Thanks in advance
> 
> Regards,
> 
> Jan Eeuwe Broos


Reply via email to