Generate MVC Files Easily from a Template and your Database

Generate MVC Files Easily from a Template and your Database

Originally, I did not plan on releasing this Java application I wrote which I named Web App Builder.   I created it to help me build models, controllers, views, and forms automatically for CodeIgniter, or any other frameworks I was working with, using templates and my database structure.   It could even be used for jQuery functions such as posting values etc....


Using Web App Builder Step by Step

  1. Enter your database username and password and you can optionally change the Host and port if its required.  Click Connect.
  2. Select the Database you want to work with.
  3. At this point you now have two options; (1) you can either choose multiple tables to build models for or you can  (2)  choose one table and then select only certain columns to work with on the right.  Hold CTRL + Click to select the tables or columns you want.
  4. Now you must choose a template. It is organized by framework so select CodeIgniter,  and then select a template folder inside CodeIgniter, your options are controller, model, view and form.   There is currently only one sample template.  So select Model.
  5. Now select model3.jtpl
  6. Now depending on if you select option 1 or 2 from step three you will click either Build Models (1) or Generate Model (2).
  7.  Now check your /generated_files/model/DATABSE_NAME_HERE folder and you should see the newly created model.     

A Few More Tips

Place your model templates inside files\templates\model\template_name.jtpl There is already a sample model in this folder for you to get an idea on how to use the templates.   For a better understanding of the template syntax engine take a look at the Jtpl website.

Some of the variables available for use in the template are:

{MODEL_NAME}
{DATABASE_NAME}
{TABLE_NAME}  
{PRIMARY_KEY} - output the primary key's name
{COLUMN_ARRAY} - used for looping through column names in template
{COLUMN_COMMA_SEPARATED} - column list separated by commas

Running it on Windows XP, Vista, 7

    1. Install Java Runtime if you do not have it on your system
    2. Unzip the files to C:\dist\    (You can change this directory if you need to just modify it below) . 
    3. Move the files folder and config.properties to C:\Document and Settings\%USER_NAME%\
    4. Start > Run > java -jar c:\dist\WebAppBuilder.jar 
    5. (Windows Vista and 7 Users may need to type in a password...)

    Running it on Linux

    1. Unzip the files to whatever directory you want...
    2. Move the files folder and config.properties to /home/YOUR_USER_NAME/
    3. From command line type java -jar /DIRECTORY_TO_JAR/WebAppBuilder.jar


    Running it on Mac

    I would imagine that running a Jar file on Mac is the same as Linux... You are probably best to search Google if you do not know how to do this...

    Screenshots

      

    Download Web App Builder

    Application Only ( 725.4 KB)

    Add New Comment

    No Comments Posted.