Lift controllers example

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:

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:

  1. Type sbt to start the simple build tool. This will download the jar files needed by sbt itself.
  2. Once the sbt shell has started, type update to download the jar files needed by the application.
  3. Compile the code with compile.
  4. 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.

This entry was posted in Lift, Scala and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

HTML tags are not allowed.

515,238 Spambots Blocked by Simple Comments