Thursday, January 27, 2005

Tools to start your WebApp

Recently I had to create a J2EE app entirely based on open source tools.This was something I had not tried since university days, 2 years ago, I remembered the amount of pain that it took me to find something which would allowed me to get started as quickly as possible and also to integrate the different open souce tools together to build something that really worked seamlessly.

I needed to have the following in my application:

1. Hibernate - had not tried this one before so was high time

2. MySQL database - its basically a simple installation and very easy to maintain and there are loads of free MySql database management tools around on the net waiting to be downloaded.

3. Struts for web-tier - just needed a simple stable MVC framework , I would only be dealing with Actions and Forms as I would be using Laszlo files instead of JSP pages so the choice of struts was quickly made.

4. Tomcat 5.X - the best web server around I really appreciate it, plus it is now a standard in the web server market.

5. Ant for build tool - used this because I didnot want to bother about MAVEN config files. With MAVEN you have to specify every artifact (jar, war ,..) in MAVEN's POM files plus its too pain staking for the small project that I wanted to develop.

6. XDoclet - most open source tools dont have special interfaces with drag and drop functionality to create Struts projects so I thought if i needed to write my struts-config files by hand why not make XDoclet generate it instead. At the same time i wouldn't need to write up Hibernate configuration files ..as it was all new to me.


So i started my quest to find the ultimate tool that would quench my needs and integrate as much as possible the above mentioned items.

The first option was Eclipse 3.0 as it is very similar to Web Application Studio (WSAD is build over eclipse 2.0) and is open-souce. As the interfaces were similar and the GUI seemed attractive I downloaded the 85 MB file ..installed... and surprise no support for creating web-mobules , you need to install additional plugins which needless to say cost $XXX dollars as usual. By itself it was not going to save me time.

So I tested out NetBeans 4 IDE , I had heard about it but had never tried it before. With a size of 37 MB it was considerably lighter than Eclipse. It seems that ANT plays a major role in this tool and I was pretty happy with that , was very easy to use and I said .. hey I found the holy grail here.It provides web-app templates which create the structure of your project along with supplying an ANT build file which does most things such as build,war,deploy , etc.. . Still there was no tight integration with Struts , which I found very annoying. And you have to do all the data connections manually which is something i rather not want to lose time into ,cause I needed to quickstart here.

Then I came across AppFuse and I could not believe it , apparently a guy had similar problems getting started creating an application, so what he did was he created a base project called AppFuse which uses Ant, XDoclet, Spring, Hibernate (or iBATIS), JUnit, Cactus, StrutsTestCase, Canoo's WebTest, Struts Menu, Display Tag Library, OSCache, JSTL and Struts (or Spring MVC).

What you need to quick-start with AppFuse is simply :

  • downloading the zip file

  • extract the downloaded file to a dir of your choice

  • set your Tomcat and Ant in class path

  • perform an ant command on the appfuse dir

  • .
    .
    .
  • ... and 2-3 ant commands away you get a fully functional app


  • It basically creates your database tables (MySQL by default), creates a workspace (Eclipse by default) has sample codes and their structure for you to build on , it uses XDoclet ,Canoo, Hibernate and struts although other technologies are also supported.It is also uses Tomcat and everything can be controlled from WAR generation to test-cases and deployment on Tomcat with the ANT build file. And it definitively brings a smile to your face.

    So the choice was quickly made and I opted for AppFuse its modular structure ensures me that I can integrate other technologies in the course of the development of my project.Futhermore the WIKI for AppFuse is full of tutorials and best practises , so that was a plus too.

    Hope this helps you fellow JAVA developers started on your projects....signing out for today....

    4 comments:

    June-An said...

    J'ai rien compris... !!! Not very unusual coming from me HUH!!! :D

    Unknown said...

    Am sure u will , une fois que tu t'y met :P

    Anonymous said...

    So, Mr Javed, where have you been hiding? It's good to see Mauritians roaming the blogosphere. Check out my coding home page for some tips about programming with NetBeans 4.0.

    http://coding.mu

    Unknown said...

    Yeah you have a nice blog http://coding.mu is cool, its nice to know what other developers (inlcuding Mauritian developers) are doing. Too bad our community of devs is very limited.