Skip to content
A helloworld application
Branch: master
Clone or download
Latest commit ab46cb2 May 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main WIP Oct 27, 2018
.gitignore WIP Oct 27, 2018
LICENSE Initial commit Oct 27, 2018
README.md
pack update to act-1.8.22 May 23, 2019
pom.xml update to act-1.8.22 May 23, 2019
run_dev
run_prod
test update to act-1.8.22 May 23, 2019

README.md

ActFramework HelloWorld Demo

This application demonstrates how to use write a simplest HelloWorld application using actframework application

Start the application

Start the application in dev mode

mvn clean compile act:run

Run automate test

mvn clean compile act:test

Start the application in prod mode

mvn clean package
cd target/dist
tar xzf *.gz
./run

Once application has been started, you can open browser and locate to http://localhost:5460 get the home page.

Understanding the Demo app

The demo application contains a single Java class gallery.helloworld.AppEntry

public class HelloWorldApp {

    @GetAction
    public void home(@DefaultValue("World") @Output String who) {
    }

    public static void main(String[] args) throws Exception {
        Act.start();
    }

}

The main method call act.Act.start() method to bootstrap ActFramework and load this application:

Action handler

The AppEntry class contains one action handler method:

    @GetAction
    public void home(@DefaultValue("World") @Output String who) {
    }

@GetAction annotation without parameter tells ActFramework that this method is a handler that answers request sent to /.

Parameter String who tells ActFramework that if there is a request parameter named who the value shall be inject to this parameter when calling to this handler method.

The @Output annotation before String who tells ActFramework to put the value of who to the template using name who.

The template home.html is located at resources/rythm/demo/helloworld/AppEntry. Literally the path is corresponding to the package/class/method hierarchy, based in resources/rythm template root.

The template is created using Rythm Engine. For more information about Rythm engine, please visit the official site at http://rythmenigne.org

FAQ

Question: Why do I get the following error message ?

Cannot encrypt/decrypt! Please download Java Crypto Extension pack from Oracle

Answer: Please download and install the JCE pack from Oracle for Java 8 or Java 7

You can’t perform that action at this time.