more comfortable

This commit is contained in:
interp 2002-10-09 15:22:50 +00:00
parent 044c27e292
commit e29d3d750a
1 changed files with 18 additions and 17 deletions

View File

@ -1,6 +1,7 @@
(define-structure servlet servlet-interface
(open servlets
httpd-request
httpd-responses
url
scsh
scheme)
@ -13,8 +14,7 @@
`(html ,(if title
`(title ,title) '())
(body
,(if title `(h1 ,title) '())
(p (a (@ href "reset") "click here to reset server's servlet cache"))
,(if title `(h2 ,title) '())
(p
(form (@ (method "get")
(action ,new-url))
@ -28,27 +28,28 @@
(extract-single-binding bindings "number"))))
(if number
number
(get-number input-text "Please enter a number")))))
(get-number input-text "Please enter a valid number")))))
(define (get-number1)
(get-number "First number:"))
(get-number "First number:" "Calculation - Step one"))
(define (get-number2)
(get-number "Second number:"))
(get-number "Second number:" "Calculation - Step two"))
(define (main req)
(let ((number1 (get-number1))
(number2 (get-number2)))
(let ((req
(send-html/suspend
(lambda (new-url)
`(html (title "Result")
(body (h1 "Result")
(p ,(number->string (+ number1 number2)))
(a (@ (href ,new-url)) "done")))))
(send-html/finish '(html
(title "Finished")
(body (h1 "Finished")
(a (@ href "/") "yoh."))))))
(p ,(number->string (+ (get-number1) (get-number2))))
(a (@ (href "add.scm")) "new calculation (new instance)")(br)
(a (@ (href "javascript:history.back(2)")) "new calculation (same instance)")(br)
(a (@ (href ,new-url)) "close this instance")))))))
(send/finish
(make-http-error-response http-status/moved-temp req
"/" "/"))
))
; ))
))