World of Computer Science and Information Technology Journal (WCSIT) ISSN: 2221-0741 Vol. 2, No. 4, 147-156, 2012 147 A Generator of MVC-based Web Applications Strahinja Lazetic Instituto Superior Tecnico Universidade Tecnica de Lisboa Lisbon, Portugal Dusan Savic, Sinisa Vlajic, Sasa Lazarevic The Faculty of Organizational Sciences Belgrade University Belgrade, Serbia AbstractThis paper presents a generator of Spring MVC-based web applications. The generator was designed using Freemarker template and HibernateTools toolset. The generated applications are fully functional web applications based on three tiers architecture and MVC software pattern. The structure of Spring web applications is explained in brief, while designed templates and their role in the process of code generation are elaborated in more detail. The generator was designed to show a possibility for fast development of a custom generator as a solution for specific application requirements. Keywords- applications generator; Spring; Freemarker; HibernateTools; MVC. I. INTRODUCTION Nowadays when information technologies represent one of the fastest developing business areas, many software companies can respond to client requirements with the same quality. Time and price (that depends on time) required for project realisation became the crucial factors for getting a job. The question is how these costs can be reduced thus improving productivity and surpassing competition. Application generators are being imposed as a solution for the problem. They represent software components that automatically produce other software components. Every generator uses a specific input and produces an output by applying defined rules. Commonly used inputs are data model and templates. Outputs can be different kinds of text files such as HTML pages, Java source code files, SQL scripts and XML files. Using generators has many advantages over manual coding. It significantly reduces time required for application design. A generator increases the quality of source code by producing standardized code hence reducing number of syntax errors which are common for manual coding. In addition, changing application code requires only changes in particular templates and restarting the generator. Developing a generator as a highly sophisticated software component motivates software developers and reduces monotony which would appear during manual coding of significant amount of similar or repetitive code [1]. There are many papers reporting research and practice in designing applications generators . Basically, there are two approaches to developing application generators one based on proprietary software components, predominantely generating .NET applications (Microsoft-technology oriented) and the other one, based on integration of Java-centered free software tools. Some examples of the former approach are [2], [3], [4], [5], [6]. Examples of the later approach are JAG - Java Application Generator [7], Skyway Builder [8], etc. These generators, in general, are based on freely available components and technologies such as EJB and Hibernate [9], [10] template engines such as FreeMarker and application development frameworks, such as Spring framework [11] or JBoss Seam framework [12]. Skyway Builder, for example, is a template-based generator and one of the well known commercial solutions for applications generation. It uses templates written in XML/XSL and generates fully functional Spring applications that implement basic CRUD operations. Further on, generators may be based on independent or a specific data model. For example, a UML specificationbased source code generator [13] is an application generator which uses independent data model based on UML specification. This paper describes fast development of a simple application generator for a specific application. Its main task is to justify development of a custom generator from the very beginning in case of short time limits and specific project requirements. The generator relies on an existing database as a starting point for code generation and produces fully functional Spring applications using designed templates. Its development is semi-automated because existing code libraries are used for data model production.