Introduction

MVC Framework

MVC Framework is based upon separation on 3 types of components:

  • Model: the model is the part of the application that stores business data. It is usually a database, or any library used to access data, or business components (hibernate, ejb...).
  • View: the view component is the part of the program that is in charge of displaying data.
  • Controller: the controller is the glue that is between Model and View. It aims to react on user inputs, to apply changes on model, and to select data to be displayed on view.

    MVC Web Project plugin is a generic eclipse plugin that displays graphically relations between controllers, and views. It organizes application in graph nodes of two types: controllers and views. Nodes are grouped in packages, in order to facilitate application's structuring.

Struts 2

Struts 2 framework has been chosen to implement MVC framework. Plugin is able to export an XML file for Struts 2 , but it does not use struts2.xml file as base project-file. Instead, we use a ".aswp" file that keeps all required data such as node definitions, nodes positions in the graph,...

This file is an XML file. When saving to disk, plugin automatically apply some XSLT templates to generate a struts 2 XML file. By default, the target file is named "alveole-struts.xml".

Plugin is packaged in order to facilitate new dynamic web projects creation.

General use

Steps to setup a MVC Web Project are the following:

  • Create a new dynamic web-project in eclipse,
  • In that project, create a new Alveole Studio MVC Web Project file (.aswp file).
  • Edit the created Web Project file, using Alveole Studio Web Project editor. Create your application with its controllers (named actions) and views.
  • Export your war file, and simply deploy it on your web-app server.
  • Since version 0.5.0, you also can import your existing struts2 config files. After creating your project (following upper described steps), copy your struts2 xml files into your newly created project, rightclick on them and click import in popup menu. Then choose Web/Import Struts2 file into MVC Web Project. (Backup your struts2 files before importing them if you directly import files from their original location).

Advantages / Drawbacks

Drawbacks

  • Currently, existing Struts2 projects cannot be imported to create a new Alveole Studio MVC Web Project.
  • Not possible to split aswp file in several ones (would be interresting for concurrent acess).
  • Cannot split generated struts file in several.

Advantages

  • Eclipse Plugin automatically performs many the tasks to build your project (example: it automatically paste struts2 dependencies in your project, changes the web.xml file, and paste struts2.xml file).
  • Graph view greatly facilitate to maintain your application's code.
  • Classes and JSP are automatically created or opened/focused when double-clicking on a node.
  • Ability to copy / paste a part of the graph (feature not currently stable).