demo10.servlet

;; this servlet shows another way to create ;; lists and tables (servlet () {<html> <head> <title>list/table demo</title> <style type="text/css" media="screen"> <!-- td.b \{background:lightgreen; font:bold 18pt\} li.a \{font:italic 13pt fantasy\} --> </style> </head> <h1> Here is a servlet generate list</h1> <ol> [(lis {class="a"} `(mon tue wed thu fri sat sun) )] </ol> <br> <hr> <br> <table border=5 cellpadding=10 cellspacing=4> <tr> <th>sun</th> <th>mon</th> <th>tue</th> <th>wed</th> <th>thu</th> <th>fri</th> <th>sat</th> </tr> [(trs {class= "b"} `( ( 9 - - - - - - ) (10 gym - gym - - - ) ) ) ] } )

demo11.servlet

(servlet (a) ;; this servlet just squares numbers.... (case a ((#null) {add ?a=11 to the URL please}) (else {the square of [a] is [(* a a)]} )))

demo12.servlet

(servlet (a b) ;; compute area and perimeter of a right triangle ;; with sides of length a and b (case a ((#null) {Enter ?a=3&b=4 at the end of the URL}) (else {The area of a triangle with sides [a] and [b] is [(* a b 0.5)] and the perimeter is [(+ a b (sqrt (+ (* a a) (* b b))))]} )))(servlet (a b) (case a ((#null) {you know...}) (else (let ((hyp (sqrt (+ (* a a) (* b b))) )) {The perimeter is [(+ a b hyp)]} ))))

demo13.servlet

(servlet (a b c) (case a ((#null) {enter a,b,c}) (else (let* ((p (+ a b c)) (s (/ p 2.0)) (area (sqrt (* s (- s a) (- s b) (- s c)))) ) {The area of an [a],[b],[c] triangle is [area]} ))))

demo14.servlet

(tryCatch (servlet (a b c) (case a ((#null) {Enter a,b,c}) (else (define p (+ a b c)) (define s (/ p 2)) (define area (sqrt (* s (- s a) (- s b) (- s c)))) {The area of a [a],[b],[c] triangle is [area]} ) ) ) (lambda(e) {There was an error:[e]. Be careful with my servlet} ) )