spiffyui / SpiffyForms

This sample shows you how to do a full CRUD application with Spiffy UI. A simple user form show lists of users and user details while communicating with a simple REST server.

Home Page:http://www.spiffyui.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spiffy UI - GWT made simple

This sample shows you how to create, read, update, and delete with Spiffy UI forms. It includes a simple REST server running on Java with Jersey.

Everything starts with a REST bean named User.java. This bean handles the CRUD operations of our application. The UI is handled in Index.java.

This application shows you how to make the full range of REST requests and build complex form layouts with Spiffy UI. All data is stored in memory on the server so there's no additional setup. Just build it and run it and you'll get an application that looks like this:

Building and Running SpiffyForms

This project is built with Apache Maven.

Go to your project's root directory and run the following command:

mvn package jetty:run

This will download the required libraries, build your project, and run it. You can access the running application here:

http://localhost:8080

Debugging through Eclipse

See Spiffy UI's GWT Dev Mode page for more information.

The REST API

This application exposes a simple REST API for editing users:

GET /api/users - Get a list of users including user details.

[
    {
        "birthday": "-11995200000",
        "lastName": "Addams",
        "userID": "aadams",
        "desc": "Alice Addams is just some girl",
        "email": "aadams@amazon.com",
        "gender": "female",
        "firstName": "Alice",
        "password": "aaa"
    },
    {
        "birthday": "269582400000",
        "lastName": "Brown",
        "userID": "bbrown",
        "desc": "Bob Brown is just some guy",
        "email": "bbrown@bn.com",
        "gender": "male",
        "firstName": "Bob",
        "password": "b0bpass"
    }
]

*GET /api/users/ - Get the data about the specified user.

{
    "birthday": "-11995200000",
    "lastName": "Addams",
    "userID": "aadams",
    "desc": "Alice Addams is just some girl",
    "email": "aadams@amazon.com",
    "gender": "female",
    "firstName": "Alice",
    "password": "aaa"
}

Returns a 404 if the specified user ID doesn't exist

*POST /api/users/ - Add the specified user.

Input:

{
    "birthday": "-11995200000",
    "lastName": "Addams",
    "userID": "aadams",
    "desc": "Alice Addams is just some girl",
    "email": "aadams@amazon.com",
    "gender": "female",
    "firstName": "Alice",
    "password": "aaa"
}

Output:

{"success": true}

*PUT /api/users/ - Update information about the specified user.

Input:

{
    "birthday": "-11995200000",
    "lastName": "Addams",
    "userID": "aadams",
    "desc": "Alice Addams is just some girl",
    "email": "aadams@amazon.com",
    "gender": "female",
    "firstName": "Alice",
    "password": "aaa"
}

Output:

{"success": true}

*DELETE /api/users/ - Delete the specified user from the system

Output:

{"success": true}

Returns a 404 if the specified user ID doesn't exist

License

Spiffy UI is available under the Apache License, Version 2.0.

About

This sample shows you how to do a full CRUD application with Spiffy UI. A simple user form show lists of users and user details while communicating with a simple REST server.

http://www.spiffyui.org

License:Apache License 2.0


Languages

Language:Java 95.4%Language:CSS 4.6%