https://github.com/josedonizetti/aerogear-controller-demo
https://github.com/josedonizetti/aerogear-controller-demo
Last synced: 15 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/josedonizetti/aerogear-controller-demo
- Owner: josedonizetti
- License: apache-2.0
- Created: 2012-07-31T01:01:56.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-08-01T02:22:23.000Z (over 12 years ago)
- Last Synced: 2025-04-12T08:16:45.258Z (15 days ago)
- Language: Java
- Size: 209 KB
- Stars: 0
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# aerogear-controller-demo - very lean mvc controller
## how to create a new project
### basic use case
1. add the maven dependency
org.jboss.aerogear
aerogear-controller
1.0.0.Alpha
compile
1. create a pojo controller
public class Home {
public void index() {
}
}1. create a Java class containing the routes (must extend `AbstractRoutingModule`)
public class Routes extends AbstractRoutingModule {
@Override
public void configuration() {
route()
.from("/")
.on(RequestMethod.GET)
.to(Home.class).index();
}
}1. create a jsp page at `/WEB-INF/pages//.jsp`
hello from index!
### parameter populationYou can use immutable beans straight away as controller parameters:
public class Store {
public Car save(Car car) {
return car;
}
}This can be populated by putting a route to it (preferrably via post, of course)
route()
.from("/cars")
.on(RequestMethod.POST)
.to(Store.class).save(param(Car.class));And you can use a simple html form for it, by just following the convention:
The car object will be automatically populated with the provided values - note that it supports deep linking, so this would work fine too:
All the intermediate objects are created automatically.