GWT app in 30 minutes

    Just the other day, a new (yet unstable) version of Spring-Roo was released, one of the main features of which is support for generating the user interface on GWT.

    I became interested, today I experimented, under the cut, the translation of my blog (for those who are too lazy to read in English) with a description of how to make a GWT application in less than 30 minutes. I hope the residents of Khabrov will find this interesting and useful.

    What are we talking about

    Spring-Framework is one of the most popular frameworks for Java. I think almost everyone who wrote web applications in Java came across it;
    Spring-Roo is a utility for quickly generating a project: entity classes for working with the database, typical CRUD, and a number of other typical tasks. As I understand it, the idea grows from Ruby-On-Rail - but I can be wrong
    GWT - a library for creating modern web applications with the active use of ajax. Developed by Google and more and more gaining popularity.

    First we need JDK 1.6 (what a surprise!) And Apache Maven . I hope people interested in GWT and Spring install these products immediately after installing the operating system.

    Download the latest version of Spring-Roo 1.1M1 from the siteSpring Source

    Download the script for roo: clinic.roo - this is almost the same clinic.roo that goes in the examples, but only adapted for using GWT:
    * Enum commented out - they apparently are not supported for now;
    * Boolean field is changed from primitive to java.lang.Boolean (it also led to a compilation error - apparently not yet supported)
    * One-to-many link (in the form of the Set collection) - commented out - not supported yet while generating GWT
    * Calendar is replaced by Date;
    * The code generating the user interface on Spring-MVC is commented out
    * And the generation of the interface on GWT is enabled (gwt setup command)

    Run this script:
    # roo
    roo> script --file clinic.roo
    roo> exit

    We are waiting for some time while roo will generate the source codes for the project for us. As a result, we have an almost standard project using maven for assembly.

    Run it: Here you will have to wait a while, because during the assembly all the necessary libraries will be downloaded (and there are a lot of them). Reassemblies will be much faster. Copy the proposed URL and open it in a browser. Your GWT application is ready!

    # mvn gwt:run




    Spring-Roo is a good idea, but its integration with GWT is still damp - many things do not work.
    But it’s quite possible to use it for (for example) learning and quick start - what it will help you with, I hope

    Also popular now: