A MatchWithoutCurrentValue
example for Lift 2.6.
We have a Menu.param
matching /product/{id}.
There is one known product ID: 1
.
-
A request of /product/1 should produce a "product information" page which simply echos the product ID.
-
A request of /product/2 should redirect the user to the home page.
$ sbt
> container:start
Try the above URLs:
- http://127.0.0.1:8080/ (home page).
- http://127.0.0.1:8080/product/1 (product detail page).
- http://127.0.0.1:8080/product/2 (should redirect to home page).
The Menu.param
is created and added to site map in Boot.scala. This is also where our "database" lives.
The ProductInfo
and rendering class is in code.snippet/products.scala.
The HTML page is src/main/webapp/product/star.html