What is Scooter framework?

A full-stack J2EE framework

Scooter is a full-stack RESTful Java web framework. It brings Ruby-on-Rails-like high productivity and fun experiences to Java.

Ruby-on-Rails-like high productivity and fun

  • No deployment: no turnaround or restart web server
  • Type and Click: type your Java code and then click browser's refresh button to see the change
  • Compile error display: browse and modify code error online
  • Compile error
  • Run-time configuration: all configuration files can be changed on the fly, including log4j.properties
  • No XML configuration files: no XML wiring
  • No more Struts Forms: Just use one of the pXXX(key) methods to retrieve a request parameter:
  • public class PostsController {
        //Response to URL like: GET /posts/123 (/posts/$id)
        public String show() {
            String postId = p("id"); //obtain post id from request
            ActiveRecord post = Post.findById(postId); //retrieve the post record from DB
            return render(post);           //return post content in a format defined by request
            //return render(post, "json"); //return post content in json format
            //return render(post, "xml");  //return post content in xml  format
        }
    }
    
    //Other pXXX() methods:
    String[] selectedInterests = pArray("interest_list"); //obtain selected interests from select list
    Boolean hasFacebookAccount = pBoolean("has_facebook"); //obtain result from http form checkbox
    Date birthDay = pDate("birthday"); //obtain birth date from http form input
    UploadFile image = pFile("myPicture"); //obtain uploaded file from http file upload
      
  • Powerful view renders: The only web framework that allows you to mix JSP (.jsp), FreeMarker (.ftl), StringTemplate (.st) views in one application.
  • public class WelcomeController {
        /**
         * sayit() method
         */
        public String sayit() {
            flash("notice", "Successfully found the message");
            setViewData("content", "Java programming is fun!");
    
            //render default view (.jsp)
            return renderView("sayit");
    
            //render FreeMarker view
            //return renderView("sayit.ftl");
    
            //render StringTemplate view
            //return renderView("sayit.st");
        }
    }
      
  • ActiveRecord ORM: No more endless annotation mapping, DAOs, XML mappings
  • //This is Post model, no more DAO
    public class Post extends ActiveRecord {
    }
    
    public class PostsController {
        //Response to URL like: GET /posts
        public String index() {
            //retrieve all records in posts table
            List records = Post.findAll();
    
            //retrieve all records with a limit of 3 records per page and skips the first 5 records
            List records = Post.limit(3).offset(5).getRecords();
    
            //retrieve a few records satisfying some conditional clauses.
            List records = Post.where("id IN (1, 3, 5, 7) AND content LIKE '%Java%'").getRecords();
    
            //retrieve all records satisfying a SQL query
            List records = Post.findAllBySQL("SELECT * FROM posts");
    
            //retrieve the blog post along with all its comments in one DB query (Earger Loading)
            ActiveRecord post = Post.where("posts.id = 101").includes("includes: comments").getRecord();
    
            ...
        }
    }
      
  • RESTful: generating 7 restful actions for each resource
  • HTTP verbURLcontrolleractionused for
    GET /posts posts index display a list of all posts
    GET /posts/add posts add return an HTML form for creating a new post
    POST /posts posts create create a new post
    GET /posts/$id posts show display a specific post
    GET /posts/$id/edit posts edit return an HTML form for editing a post
    PUT /posts/$id posts update update a specific post
    DELETE /posts/$id posts delete delete a specific post
  • i18n: support more than 50 languages out-of-box
  • Code generation
  • //Generate an AJAX CRUD app
    > java -jar tools/generate.jar ajaxtodo scaffold-ajax entry
      
  • Embedded web server (Jetty)
  • Built-in tools: database browser, file browser, route browser, etc.

Enterprise focus

Scooter Framework recognizes special needs in enterprise applications.

Easy to learn

As a developer using Scooter Framework, you only need to have the following skills:

  • basic Java (Java1.5)
  • basic Servlet/JSP

Applications developed by Scooter framework follow MVC Architecture:

  • Model: ActiveRecord or POJO
  • View: JSP (default) or templates (any format if adding a plugin handler)
  • Controller: POJO with easy rendering APIs

You do not need to use or memorize any annotations, tags or xml. You are not even required to use an IDE, although Scooter Framework does provide Eclipse project files for you in case you like to use that IDE.

Benefits of using Scooter framework

Where does the name "scooTer" come from?

Have you ever seen the smiling face when your kid or your neighbour's kid ridding a scooter? Can you imagine they could barely walk just a jew months ago? Yes, that is what we want to achieve: a tool that is simple to learn and joyful to use. Even a kid can use it :)