I’ve recently put together a basic Lift example, based on an e-Commerce theme. It contains:
- Product listing
- Basket
- Checkout
- Order confirmation
It shows the following techniques:
- How to write forms and process the response
- How to submit forms using Lift’s form.ajax helper – used to submit the first two parts of the checkout
- Using a session variable – the basket
- Logging with slf4s
You can get the code from Github:
https://github.com/hedleyproctor/amur-lift-ecommerce-example
If you don’t have a Git client installed, simply click on the “Zip” button to get the code as a zip file. Then change into the base directory and do the following:
- Type sbt to start the simple build tool. This will download the jar files needed by sbt itself.
- Once the sbt shell has started, type update to download the jar files needed by the application.
- Compile the code with compile.
- Start jetty with jetty-run.
The app will then be available on http://localhost:8080. You should be able to go to the product listing page, put a product in your basket, then go to the checkout, enter your delivery address, choose a shipping option, enter your billing details and be taken to the order confirmation page. Click the images to enlarge:
Note:If you are very new to Lift and want an even simpler example, with a more detailed tutorial on how it works, you might like to look at Building your first Lift app with sbt.