; Minimal servlet for getting information out of a request ; This is a magical incantation that makes this file a servlet ; and gives access to useful servlet functionality (require (lib "unitsig.ss") (lib "servlet-sig.ss" "web-server")) (unit/sig () (import servlet^) ; Here is where the interesting code actually starts. ; Get the bindings from the request (let ((my-bindings (request-bindings initial-request))) (cond ; make sure q is defined [(not (exists-binding? 'q my-bindings)) '(html (head (title "Error")) (body ((bgcolor "red")) (p "This page needs you to define q!")))] ; make sure r is defined [(not (exists-binding? 'r my-bindings)) '(html (head (title "Error")) (body ((bgcolor "blue")) (p "This page needs you to define r!")))] ; use the values of q and r to construct a new page [else (let ((q (car (extract-bindings 'q my-bindings))) (r (car (extract-bindings 'r my-bindings)))) `(html (head (title "Relationships")) (body ([bgcolor "white"]) (p "Every " ,q " is a " ,r "."))))])))