Struts/MVC pattern

Discussions

Web tier: servlets, JSP, Web frameworks: Struts/MVC pattern

  1. Struts/MVC pattern (4 messages)

    I am using an architecture similar to the Struts architecture (http://jakarta.apache.org/struts/). When I designed our current architecture, I wasn't aware of the Struts architecture (mine was designed from the traditional MVC), and just wanted to discuss a few difference I have found.

    We have a central servlet Controller, that forwards control to a class (RequestHandler) based on the request URL. This does processing if required, and talks to the Model for actions such as updating data in the database. This is fairly similar to Struts. At the end of the processing it returns a URL of a JSP page, and the controller forwards to that.

    Now this is where our architecture seems to differ. Our JSP pages all have page beans associated with them, and page beans also interacts with the Model as required, for example for pulling data from the database.

    The traditional MVC architecture allows both Views and Controllers to interact with the Model, but the Struts architecture (seems to me) to only have the Controller interacting with the Model.

    Could someone please comment, have I got this incorrect? Am I breaking the design of MVC by having Views interact with the Model?

    Threaded Messages (4)

  2. Struts/MVC pattern[ Go to top ]

    Hi Mils,

    Sorry, I am not sure on what you are asking but for me the MVC or STRUTS architecture looks like the old single URL web application as all the requests goes to one servlet controller and branches to JSP views. Is that right?

    Srinivas.J
  3. Struts/MVC pattern[ Go to top ]

    Hi Srinivas,

    That is how I understand it as well.

    My question is: does the Struts architecture allow the Controller to call the Model? I am not intimately familiar with Struts, but couldn't see any of this happening.

    The MVC architecture pattern does allow the Controller to call the Model (Controller can call Model and View, View can call Model).


    Thanks,
    Mils.

  4. Struts/MVC pattern[ Go to top ]

    Hi Mils Smith,

    I believe you are not breaking the MVC architechture because if you want to implement any personalization stuff in your JSPs then the JSP should interact with the model/bean to gather personalization settings for the user.

    I am not familiar with STRUTS, but just heard that it implements the MVC architecture.

    Srinivas.J
  5. Struts/MVC pattern[ Go to top ]

    Quite a good article on Struts....

    http://www-106.ibm.com/developerworks/library/j-struts/